i'm very new to the log4net, and i am trying to create several files and log to them accordingly with my method calls, and . here is my code
private static readonly ILog firstlog = LogManager.GetLogger("Data"); private static readonly ILog secondlog = LogManager.GetLogger("General");
and then i log like this:
firstlog.Info("some message"); secondlog.Info("some message");
and here is my configuration file
<appender name="General" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="C:\logs\myfile1.log"/>
<param name="Threshold" value="DEBUG"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %method %-5level %logger – %message%newline"/>
</layout>
</appender>
<appender name="Data" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="C:\logs\myfile2.log"/>
<param name="Threshold" value="DEBUG"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %method %-5level %logger – %message%newline"/>
</layout>
</appender>
<logger name="general">
<appender-ref ref="General"/>
</logger>
<logger name="data">
<appender-ref ref="Data"/>
</logger>
<root>
<appender-ref ref="Data"/>
</root>
And they are all logged in one file and the other 2 files are empty. why is this? What am i doing wrong?