14. March 2015 19:03 by martijn in
log4net Log4net is a great tool but it can be a bit tricky to get working. Adding a debug appender that logs to the visual studio output can be of great help. You can debug log4net by attaching the log4net DebugAppender:
Add a log4net app setting in your app.config file:
<appSettings>
<!-- log4net configuration when running in debug mode. -->
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
Add a debug appender in the log4net config:
<appendername="DebugAppender" type="log4net.Appender.DebugAppender">
<immediateFlush value="true"/>
<layout type="log4net.Layout.SimpleLayout"/>
</appender>
Finally add the appender to the log4net config root:
<root>
<level value="ALL"/>
<appender-ref ref="DebugAppender"/>
</root>