RSS Feed for This PostCurrent Article

Troubleshooting Log4NET Configuration

One thing with log4net is that whenever there is a configuration issue, no error or exception is thrown and this will make troubleshooting difficult.

To check if there is any configuration issue, add the followings in the app.config or web.config

Under appSettings, add the following key

   1: <appSettings>


   3:      <add key="log4net.Internal.Debug" value="true"/>


   5: </appSettings>

Configure the following trace listener

   1: <system.diagnostics>

   2:     <trace autoflush="true">

   3:       <listeners>

   4:         <add

   5:           name="textWriterTraceListener"

   6:           type="System.Diagnostics.TextWriterTraceListener"

   7:           initializeData="E:\Tools\Temp\log4net.txt" />

   8:       </listeners>

   9:     </trace>

  10:   </system.diagnostics>

Then you can see all the log4net issues in the text file.

Trackback URL

RSS Feed for This PostPost a Comment

Refresh Image