You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Sotirios Delimanolis (JIRA)" <ji...@apache.org> on 2016/01/28 01:18:39 UTC
[jira] [Commented] (LOG4NET-503) RollingFileAppender incorrectly
parses rolled over files when determining original backup size
[ https://issues.apache.org/jira/browse/LOG4NET-503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15120484#comment-15120484 ]
Sotirios Delimanolis commented on LOG4NET-503:
----------------------------------------------
This might be related to [LOG4NET-82|https://issues.apache.org/jira/browse/LOG4NET-82].
> RollingFileAppender incorrectly parses rolled over files when determining original backup size
> ----------------------------------------------------------------------------------------------
>
> Key: LOG4NET-503
> URL: https://issues.apache.org/jira/browse/LOG4NET-503
> Project: Log4net
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.15
> Reporter: Sotirios Delimanolis
> Priority: Minor
>
> Given the following files in the {{/home/sotirios/}} directory
> {noformat}
> -rw-r--r-- 1 sotirios users 1075 Jan 26 16:20 debug.log
> -rw-r--r-- 1 sotirios users 2147 Jan 26 12:35 debug.log-20150115
> -rw-r--r-- 1 sotirios users 2147 Jan 26 12:35 debug.log-20150115.1
> -rw-r--r-- 1 sotirios users 2147 Jan 26 12:35 debug.log-20150115.2
> {noformat}
> and the following sample configuration
> {noformat}
> <?xml version="1.0" encoding="utf-8"?>
> <log4net>
> <root>
> </root>
> <logger name="Test">
> <appender-ref ref="LogFileAppender" />
> <level value="DEBUG" />
> </logger>
>
> <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
> <datePattern value="'-'yyyyMMdd" />
> <encoding value="utf-8" />
> <layout type="log4net.Layout.PatternLayout">
> <param name="ConversionPattern" value="%utcdate [%property{THREAD-ID}] %-5level %logger - %message%newline" />
> </layout>
> <maximumFileSize value="1KB" />
> <maxSizeRollBackups value="5" />
> <param name="AppendToFile" value="true" />
> <param name="File" value="/home/sotirios/debug.log" />
> <rollingStyle value="Composite" />
> <staticLogFileName value="true" />
> </appender>
> </log4net>
> {noformat}
> when log4net is initialized, all the files in the directory above will be passed to [{{InitializeFromOneFile}}|https://github.com/apache/log4net/blob/log4net-1.2.x/src/Appender/RollingFileAppender.cs#L879] and the {{m_curSizeRollBackups}} will be set to 2, even though the current iteration of the base file has no backups. In this case, only the {{20150115}} rollovers have backups.
> When this {{RollingFileAppender}} eventually needs to create a backup, it will attempt to rollover backups 1 and 2 first, which don't exist.
> This is unnecessary and creates misleading WARN logs.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)