Nicolas Vecchione created LOG4NET-640:
-----------------------------------------

             Summary: minimum achieved date roll is minute
                 Key: LOG4NET-640
                 URL: https://issues.apache.org/jira/browse/LOG4NET-640
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0.8
         Environment: Windows10, Development under Visual Studio, Code in C# 
.net 4.5
            Reporter: Nicolas Vecchione


Issue with RollingFileAppender while running log4net 2.0.8. 
 
I set it to roll on both file size and date (rollingStyle Composite). I am 
setting a datePattern in order to roll every second. : "dd-MM-yyy_HHmmss".
 
However the roll I get is down to the minute. I think my pattern is right, as 
the pattern in the file name correctly is applied down to the second, however 
the roll only happens on the next full minute. I basically get the same result 
as if I was using datePattern "dd-MM-yyy_HHmm"

Here is my configuration for the appender : 
<appender name="RollingLogFileAppenderDebug"   
type="log4net.Appender.RollingFileAppender">
            <file type="log4net.Util.PatternString" 
value="%property\{LogFilePath}Prog.csv" />
            <appendToFile value="true" />
            <rollingStyle value="Composite" />
            <datePattern value="dd-MM-yyy_HHmmss" />
            <PreserveLogFIlenameExtension value="true" />
            <maxSizeRollBackups value="100" />
            <ImmediateFlush value="true"/>
            <maximumFileSize value="2MB" />
            <staticLogFileName value="false" />
            <layout type="log4net.Layout.PatternLayout">
              <header value="[Date], [Time], [Thread], [Component], [Group], 
[Purpose], [Msg]&#13;&#10;"/>
              <footer value="[Date], [Time], [Thread], [Component], [Group], 
[Purpose], [Msg]&#13;&#10;"/>
              <conversionPattern value="%d\{[dd/MM/yyyy], [HH:mm:ss.fff]}, 
[%thread], %message%newline" />
            </layout>
</appender>{{>}}
And I get files something as follow:
 * Prog.11-01-2020_004752.csv
 * Prog.11-01-2020_004752.1.csv
 * Prog.11-01-2020_004752.2.csv
 * Prog.11-01-2020_004800.csv
 * Prog.11-01-2020_004800.1.csv
 * Prog.11-01-2020_004800.2.csv
 * Prog.11-01-2020_004900.csv
 * Prog.11-01-2020_004900.1.csv
 * Prog.11-01-2020_004900.2.csv

So I started at 00h47m52s which created a log file which rolled because of max 
size reached twice, then it rolled again on the next full minute at 00h48m00s 
(which rolled because of max size reached twice) and at 00h49m00s, 00h50m00s, 
etc.  

I am confused that my datePattern is correctly recognised as far as the naming 
of the file at time of creation is concerned, yet it does not roll at the next 
second the it does at the nearest minute, hour, day.

 



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

Reply via email to