Using Enterprise Library 5.0 Logging Block in .NET 4.0 which is the only Block I am using I was trying to customize information being logged to include Call Stack, calling Assembly name and perhaps Line Numbers. So I went to text Formatter that I created and added a few entries:
Method: {property(MethodName)}{newline}
Call Stack:{property(CallStack)}
so after that matching text formatter config file entry now looks like this:
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="Timestamp: {timestamp} 
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}{newline}
Method: {property(MethodName)}{newline}
Call Stack:{property(CallStack)}"
name="Text Formatter" />
</formatters>
You can see new added entries in there. But when I run it my logging entries look like this:
----------------------------------------
Timestamp: 12/15/2011 9:51:48 PM
Message: Starting up the application
Category: General
Priority: -1
EventId: 0
Severity: Information
Title:
Machine: HCCLI066
App Domain: WindowsFormsApplicationTest1.vshost.exe
ProcessId: 2488
Process Name: C:\Projects\WindowsFormsApplicationTest1\bin\Debug\WindowsFormsApplicationTest1.vshost.exe
Thread Name:
Win32 ThreadId:2636
Extended Properties:
Method: <Error: property MethodName not found>
Call Stack:<Error: property CallStack not found>
Is there anything else I need to do to see those properties logged? How do I add completely custom property, like "Line Numbers" for example?