Search code examples
asp.netiislogging.net-2.0

Logging for ASP.NET - Best Practices


What is the best way to write minimal error logs in an ASP.NET 2.0 web page or web service? For my purposes it'd be best if this was vanilla, and the implementation would work through IIS's virtual directories. I'm currently using the standard TextWriterTraceListener, but it doesn't seem to write to the virtual directory.

FYI - the TextWriterTraceListener's configuration follows:

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData=".\VirtualDirectory\SomeLog.log" />
      </listeners>
    </trace>
  </system.diagnostics>

I appreciate your help!


Solution

  • You could try log4net framework. It is very powerfull open-source .NET logging framework. Take a look at Log4net web site