[ 
https://issues.apache.org/jira/browse/LOG4NET-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13667750#comment-13667750
 ] 

Horst Beham commented on LOG4NET-378:
-------------------------------------

LOGNET-369 is something different. It uses <staticLogFileName value="true" /> 
and the default CountDirection. I believe in that scenario the problem was that 
existing log files are not renamed correctly when rolling over before the new 
log file (with a fixed name) was created. Although the file name didn't have 
the desired naming pattern, no data was lost in this case.

In my scenario CountDirection is +1 and staticLogFileName=false, so there is no 
file renaming involved. Debugging the code I noticed that log4net was testing 
whether a file name starts with a string that was generated by CombinePath(), 
which only inserted the date but not the segment number before the ".log" 
extension. Since "flotto.20130527.0.log" doesn't start with 
"flotto.20130527.log", my existing log segments were ignored. 
When preserveLogFileNameExtension is false, the comparison would be 
"flotto.log.20130527.0".StartsWith("flotto.log.20130527"), which returns true.
                
> Rolling log file is overwritten when application is restarted
> -------------------------------------------------------------
>
>                 Key: LOG4NET-378
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-378
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.11
>            Reporter: Horst Beham
>            Priority: Critical
>
> My server process uses log files which roll on date and file size (4MB). 
> When I restart the server and there are already more than 1 log files for the 
> current date, the 2nd segment gets overwritten and the 3rd, 4th, ... may get 
> overwritten later, when #2 is filled up again.
> I'm using version 1.2.11, which I can't select in the "Affects Version" combo 
> box.
> e.g. 
> flotto.20130527.0.log = 4MB
> flotto.20130527.1.log = 0MB (just got overwritten when the server was 
> restarted)
> flotto.20130527.2.log = 4MB (still contains original data but will be 
> overwritten too as soon as #1 fills up)
> flotto.20130527.3.log = 4MB (same as above)
> The configuration in MyServer.exe.config looks like this:
> <log4net>
>     <appender name="LogFileAppender" 
> type="log4net.Appender.RollingFileAppender">
>       <file value="flotto.log" />
>       <appendToFile value="true" />
>       <encoding>utf-8</encoding>
>       <preserveLogFileNameExtension value="true"/>
>       <rollingStyle value="Composite" />
>       <staticLogFileName value="false" />
>       <datePattern value=".yyyyMMdd"/>
>       <countDirection value="1"/>
>       <maximumFileSize value="4MB" />
>       <layout type="log4net.Layout.PatternLayout">
>         <conversionPattern value="%date [%-7thread] %-5level %-35logger - 
> %message%newline" />
>       </layout>
>     </appender>
>     <root>
>       <level value="INFO" />
>       <appender-ref ref="LogFileAppender"/>
>     </root>
>     <logger name="Flotto.FlottoService">
>       <!--<level value="DEBUG"/>-->
>     </logger>
>     <logger name="Flotto.TcpServer">
>       <!--<level value="DEBUG"/>-->
>     </logger>
>     <logger name="Flotto.UdpBroadcastReceiver">
>       <!--<level value="DEBUG"/>-->
>     </logger>
>     <logger name="Flotto.GpsTrackerGprsServer">
>       <level value="DEBUG"/>
>     </logger>
>     <logger name="Flotto.SmsAtHttpReceiver">
>       <level value="DEBUG"/>
>     </logger>
>     <logger name="Flotto.SmsAtHttpSender">
>       <level value="DEBUG"/>
>     </logger>
>     <logger name="Flotto.BulksmsComHttpReceiver">
>       <level value="DEBUG"/>
>     </logger>
>     <logger name="Flotto.BulksmsComHttpSender">
>       <level value="DEBUG"/>
>     </logger>
>     <logger name="Flotto.TrackerManager">
>       <!--<level value="INFO"/>-->
>     </logger>
>   </log4net>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to