Mario Sansone created LOG4NET-669:
-------------------------------------

             Summary: Log4net jumps between 2 log files on the same day
                 Key: LOG4NET-669
                 URL: https://issues.apache.org/jira/browse/LOG4NET-669
             Project: Log4net
          Issue Type: Bug
          Components: Appenders, Core
    Affects Versions: 1.2.11
         Environment: Windows Server 2016, .Net Framework 4.5.1, C# ASP.Net Web 
app with WCF Webservice, Moderate traffic with 5-10 accesses (log lines) per 
seconds in rush hour.
            Reporter: Mario Sansone


I have the following requirement in my ASP.Net web project:
 * log4net should be used to create a log file for each day
 * in my web application root dir there should be a folder "logs"
 * in the folder "logs" there should be a folder "YYYY-MM-DD" for each day
 * Inside each day folder there is a logfile called "logfile.txt"

I have the following log4net configuration in web.config:

 

{{<log4net>}}
{{  <appender name="RollingFileAppender" 
type="log4net.Appender.RollingFileAppender">}}
{{    <threshold value="INFO" />}}
{{    <file value="logs/" />}}
{{    <datePattern type="log4net.Util.PatternString" 
value="yyyy-MM-dd\\'logfile.txt'" />}}
{{    <appendToFile value="true" />}}
{{    <rollingStyle value="Date" />}}
{{    <staticLogFileName value="false" />}}
{{    <layout type="log4net.Layout.PatternLayout">}}
{{      <conversionPattern value="%date [%thread] %-5level (%logger:%line) - 
%message%newline" />}}
{{    </layout>}}
{{  </appender>}}
{{  <root>}}
{{    <level value="ALL" />}}
{{    <appender-ref ref="RollingFileAppender" />}}
{{  </root>}}
{{ </log4net>}}

 

This configuration worked very good a long time, BUT since 3 months, we 
observed a strange behaviour: Each day log4net jumps between 2 files and logs 
the lines sometimes in the first file and then for some seconds/minutes in the 
other file and then back to the first file and so on. For example:

 

{{../logs/2021-07-03/logfile.txt <-- this day was okay, all logs are in 1 file}}
{{../logs/2021-07-04/logfile.txt <-- this file starts at 00:00:00}}
{{../logs/2021-07-04/logfile.txt2021-07-04/logfile.txt <-- this was created 
additionally on the same day, and then log4net jumps between these 2 files}}

 

You see that log4net creates a folder in between named "logfile.txt2021-07-04". 
This is the pattern every day now. But it only creates 2 files, not more per 
day. Sometimes the logs jump within 1 second between these 2 files if there is 
lots of traffic on our webapplication.

We use a very old stable log4net version 1.2.11, but it works before without 
any problems. Nothing was changed to the log4net configuration, the only change 
could be that perhaps more users access the web application than before.

What could be the reason for this? Is there any workaround I can do?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to