Hot to configure EnterpriseLibrary.Logging to only output message and timestamp
- by thomas nn
I am trying to log a simple string to a log file.
I only need Category, message and timestamp.
Thus I have configured app.config like this:
<listeners>
<add name="Flat File Destination"
fileName="C:\Log\Phoenix.Common.Tests\Debug.log"
header="-----------------------------------------------------------------"
formatter="Text Formatter" footer="" rollFileExistsBehavior="Increment" rollInterval="Midnight" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</listeners>
<formatters>
<add name="Text Formatter" template="Category: {category} Message: {message} Timestamp: {timestamp}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</formatters>
But I get all kind of additional stuff in my log file:
Priority: 50
EventId: 50 Severity: Verbose
Title:Testing Log
Machine: DK-PC-P4740
App Domain: TestAppDomain: 80803a4f-8e18-47bb-901e-cdac784c8041
ProcessId: 6492
Process Name: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe
How do I avoid this additional stuff?
Can someone send me a link to an example that only log the message into the log file?
/Thanks