views:

383

answers:

1

The following listener will create an event entry when the Trace.WriteLine is called. If the source does not exist he will create it in the default log channel which is 'Application' . I want to specify another default Log channel but after searching for 45 minutes i don't seem to find the solution. Any ideas?

<configuration>   
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="myListener"               
          type="System.Diagnostics.EventLogTraceListener"
          initializeData="Source">          
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>
+1  A: 

Not sure that you can via the config.

Though the EventLogTraceListener does accept a different eventlog as a parameter in the constructor. Unfortunately, the class is sealed so you can't simply derive from it and pass a different value for the constructor.

Though you could follow this approach and construct your own class(seems fairly simple). And then reference that type in your config. http://weblogs.asp.net/psteele/archive/2006/02/23/438936.aspx

Brian Rudolph