[
https://issues.apache.org/jira/browse/LOG4NET-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104760#comment-16104760
]
ASF GitHub Bot commented on LOG4NET-571:
----------------------------------------
GitHub user EbenZhang reopened a pull request:
https://github.com/apache/logging-log4net/pull/13
Support combination of roll by size, preserve file extension and folder
[LOG4NET-571](https://issues.apache.org/jira/browse/LOG4NET-571)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Nicologies/logging-log4net develop
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/logging-log4net/pull/13.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #13
----
commit f939aea483c33f8e78c35426af97e11ed9be0a57
Author: EbenZhang <[email protected]>
Date: 2017-07-27T13:46:23Z
Support combination of roll by size, preserve file extension and folder
----
> Rolling by size, Preserve Extension, and Folder don't work together
> -------------------------------------------------------------------
>
> Key: LOG4NET-571
> URL: https://issues.apache.org/jira/browse/LOG4NET-571
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0.8
> Reporter: EbenZhang
>
> Those three don't work well together, the oldest file won't be deleted, e.g.
> {code:xml}
> <appender name="MyAppender" type="log4net.Appender.RollingFileAppender">
> <file type="log4net.Util.PatternString" value="SomeFolder\myLog.txt" />
> <appendToFile value="true" />
> <rollingStyle value="size" />
> <maximumFileSize value="2KB"/>
> <maxSizeRollBackups value="10"/>
> <countDirection value="1"/>
> <preserveLogFileNameExtension value="true"/>
> <staticLogFileName value="false" />
> </appender>
> {code}
> Because in [RollingFileAppender line
> 1496|https://github.com/Nicologies/logging-log4net/blob/develop/src/Appender/RollingFileAppender.cs#L1496],
> the folder will be stripped, as a result the code is unable to find the file
> to delete.
> {code:java}
> string extension = Path.GetExtension(archiveFileBaseName);
> string baseName = Path.GetFileNameWithoutExtension(archiveFileBaseName);
> int lastDotIndex = baseName.LastIndexOf(".");
> if (lastDotIndex >= 0)
> {
> archiveFileBaseName = baseName.Substring(0, lastDotIndex) + extension;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)