I'm using log4net to log my application (This is a WPF application). The logging works well in debug mode, but it doesn't work with my deployed version. The application is installed in C:\Program Files (x86)\MyApp (I use InnoSetup to create the installer). In debug mode, the log folder is well created and the log files too. In the deployed version, nothing appears, the log folder isn't created.
Here is my log4net configuration:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<log4net>
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log\main.log" />
<encoding value="utf-8" />
<appendToFile value="true" />
<maximumFileSize value="1000KB" />
<maxSizeRollBackups value="0" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger: %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="FileAppender" />
</root>
</log4net>
</configuration>
This is how I write in logs in my classes (this example is from App.xaml.cs):
protected static readonly ILog log = LogManager.GetLogger(typeof(App));
static App()
{
log4net.Config.XmlConfigurator.Configure();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
log.Info("This is an info log");
}
I've tried to change the level value to ALL, but nothing changes. I think it may be a parameter to set, because it works well in debug mode (the logs files are properly created in the folder "x86\Debug\log\".
I've made some researches but I found nothing about that.