Hot to configure EnterpriseLibrary.Logging to only output message and timestamp

Posted by thomas nn on Stack Overflow See other posts from Stack Overflow or by thomas nn
Published on 2010-04-07T14:53:59Z Indexed on 2010/05/20 3:00 UTC
Read the original article Hit count: 704

Filed under:

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

© Stack Overflow or respective owner

Related posts about enterprise-library