So this is a thing that I've come across a few times lately - How do I log, when my logger isn't working. So the scenario I've been in was to create a new appender to the log4net framework, that ships with Umbraco and many other frameworks. If for some reason you need to debug/log what happens before the logger can actually write anything, you are able to set the debugger into debug mode, and then add a tracer to your site to get actual debug-logs from log4net, which usually will show, where the issues lies. 

Setting the application into debug mode is done by adding this appSetting to your web.config(or app.config) file:

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

Once log4net is in debug mode, it will write all the extra informations into a listening tracer. So how to easily grab the trace? Well I've had success by just configuring a local .txt file to write the traces into. This is default .net configuration setup, and can be done like this:

<system.diagnostics>
   <trace autoflush="true">
      <listeners>
         <add name="textWriter" 
type="System.Diagnostics.TraceWriterTraceListener"
initializeData="d:\temp\log4net\trace.txt" />       </listeners>    </trace> </system.diagnostics>

And that's it - with the above configurations, the traces will be written into the d:\temp\log4net folder, and they will review exceptions etc when setting up log4net.

 

Hope this helps you - happy logging