Wednesday, January 2, 2008

Log4Net Debugging Trace Troubleshooting

I couldn't have made it work without the trace. Make sure the following sections are in your Web.config. Then look for the log files in the application root. The directory should have 'write' permissions for ASP.NET user.

<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>

<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="textWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="log4net_trace.txt" />
</listeners>
</trace>
</system.diagnostics>

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

<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="log-file.txt" />
<appendToFile value="true" />
</appender>

<root>
<level value="ALL"/>
<appender-ref ref="FileAppender"/>
</root>

</log4net>

</configuration>

No comments:

Check This Out!

More Links to Good Information