Click here to Skip to main content
15,918,516 members
Please Sign up or sign in to vote.
4.67/5 (2 votes)

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:\\Logs\\MyProject\\" />
      <appendtofile value="true" />
      <rollingstyle value="Date" />
      <datepattern value="yyyy-MM-dd'.log.txt'" />
            <staticlogfilename value="false" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionpattern value="%date  %level  %type{1}.%method - %message%newline" />
      <level value="INFO" />
      <appender-ref ref="RollingLogFileAppender" />

Updated 30-Jun-14 4:35am

1 solution

You are using the "Rolling File Appender" which as its name suggests rolls to a new file on dates, try using the FileAppender, see here :[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900