log4net - Appenders not working in IIS7.5

You can enable log4net internal debugging by adding the key log4net.Internal.Debug to your application configuration file.

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

This will write debug messages to the console and the System.Diagnostics.Trace system. You can then log these messages to a text file by adding a trace listener to you configuration file. Make sure the application has permission to write to the file.

<system.diagnostics>
    <trace autoflush="true">
        <listeners>
            <add 
                name="textWriterTraceListener" 
                type="System.Diagnostics.TextWriterTraceListener" 
                initializeData="C:\tmp\log4net.txt" />
        </listeners>
    </trace>
</system.diagnostics>

Alternatively, trace messages are also written to the system debugger, so you can use a utility like DebugView to capture the messages. See the log4Net FAQ for more details.


I finally got it working, i added

<trust level="Full" />

to system.web.

With medium, the AdoNetAppender stops working, but the FileAppender still works for medium and high.