I have read every answer related to this question and nothing has helped me. This is my Web.config file (I use log4net in my WCF service)
(Only the relevant section)
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<!-- Log4Net -->
<log4net>
<root>
<level value="All" />
<appender-ref ref="FileAppender" />
</root>
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs\server.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] [%property{ip}] - %message%newline" />
</layout>
</appender>
</log4net>
The log file is being created but nothing is being written to it. I have read an answer that said it could be due to not providing a layout pattern, but I am providing that. I am watching for changes:
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace Foo
{
class Bar : IBar {
//..
}
}
I have been struggling for over an hour now and can’t find anything that helped. I tried tracing log4net messages but there is no error (nothing being written to the trace file). Can anyone see anything wrong with my configuration?
Try changing the level to all upper-case:
See Why are all my log4net levels false?