views:

115

answers:

2

I had to move to the entlib logger from log4net. I know what you're thinking? :)

Anyways, I am trying to change the default template for the logger to get rid of the useless info - like like priority etc.. But my logs still have it - all those value are either null or default (value-types) in the log entry that's created. Here's the template:


<add template="Timestamp: {timestamp}{tab}Category: {category}{tab}Severity: {severity}{newline}
Process Id: {processId}{tab}Thread Id: {win32ThreadId}{newline}
Message: {message}"
      type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="Text Formatter" />

I am still getting Event ID, Titel, Machine, Priority and Process name. Any help would be appreciated.

+1  A: 

In the config file (app.config) there is an element formatters. You can change this (preferable with the config tool). One of mine looks like this:

<add 
 template="{timestamp}  {machine}:{processId}:{threadName}({win32ThreadId}) {message}"
    type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    name="LogFileFormatter" />
Sascha
A: 

Is there a way to name the old roll-over log files using an number instead of time-stamp and specify the max roll-over count - like in log4net?

imaverick