Yes Steve, I still have doubt..
I have added the following code in my web.config file
<log4net debug="true">
<appender name="RollingLogFileAppender">
type="log4net.Appender.RollingFileAppender">
<file value="C:\\TestProj\\TestLog.txt" />
<appendtofile value="true" />
<rollingstyle value="Size" />
<maxsizerollbackups value="10" />
<maximumfilesize value="2KB" />
<staticlogfilename value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionpattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
And added the following code in the .cs file
ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
log.Debug("This a test debug message");
In this case nothing is getting written in the file. What I understood from the above reply is, it should log the content to the file as I am not checking any conditions, even if the log level is
INFO.
I think the above code should write something to log file and the following code shouldn't, as there is a check.
ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
if (log.IsDebugEnabled)
{
log.Debug("This a test debug message");
}
Can you help me on this?
Thanks