Allow for dates that aren't necessarily in the yyyy-MM-dd format.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/1a8eb94d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/1a8eb94d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/1a8eb94d

Branch: refs/heads/pr/old/43
Commit: 1a8eb94da4cf9b7b0f88140407486bd9defc901a
Parents: 2002917
Author: Steven Nicholas <[email protected]>
Authored: Wed Mar 8 09:08:26 2017 +0200
Committer: Dominik Psenner <[email protected]>
Committed: Thu Jun 22 22:39:32 2017 +0200

----------------------------------------------------------------------
 src/Appender/RollingFileAppender.cs | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/1a8eb94d/src/Appender/RollingFileAppender.cs
----------------------------------------------------------------------
diff --git a/src/Appender/RollingFileAppender.cs 
b/src/Appender/RollingFileAppender.cs
index 63ffaeb..82f8417 100644
--- a/src/Appender/RollingFileAppender.cs
+++ b/src/Appender/RollingFileAppender.cs
@@ -1026,7 +1026,14 @@ namespace log4net.Appender
             {
                 // if the "yyyy-MM-dd" component of file.log.yyyy-MM-dd is 
passed to TryParse
                 // it will gracefully fail and return backUpIndex will be 0
+                // If the date format does not contina any -'s then we have to 
do additional checks.
                 SystemInfo.TryParse(fileName.Substring(index + 1), out 
backUpIndex);
+
+                // We may have picked up a date in a format without "-" eg. 
yyyyMMdd...
+                if (backUpIndex > m_maxSizeRollBackups && m_rollDate)
+                {
+                    backUpIndex = 0;
+                }            
             }
 
             return backUpIndex;

Reply via email to