asp.net – Adding tracelistener to web.config

asp.net – Adding tracelistener to web.config

You should use system.diagnostics section.
Heres example from MSDN for text file:

<configuration>
  <system.diagnostics>
    <trace autoflush=false indentsize=4>
      <listeners>
        <add name=myListener 
          type=System.Diagnostics.TextWriterTraceListener 
          initializeData=TextWriterOutput.log />
        <remove name=Default />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>

This is for system events log: http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlogtracelistener.aspx

asp.net – Adding tracelistener to web.config

Leave a Reply

Your email address will not be published.