1
Answer

How to stop log4net from creating two log files

Neelam Chandra

Neelam Chandra

10y
906
1
Hello,
I am using below code in my web.config and I found there are two log files getting created . 
For some reason every day the logger switches at times to an alternate log file with the filename (which is supposed to be yyyy-mm-dd.log.text) repeated twice. So there are always two log files. 
Please guide me if I am missing something or making any mistake.
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\AllLogs\\projectname\\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<DatePattern value="yyyy-MM-dd'.log.txt'"/>
<!--<maxSizeRollBackups value="10" />
<maximumFileSize value="500MB" />-->
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level %type{1}.%method - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
 
 
Thanks, 
Answers (1)