You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2017/04/30 17:30:36 UTC

logging-log4net git commit: try to reproduce PR 23 of https://github.com/apache/log4net/pull/23

Repository: logging-log4net
Updated Branches:
  refs/heads/PR_23 [created] ce481db1b


try to reproduce PR 23 of https://github.com/apache/log4net/pull/23


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

Branch: refs/heads/PR_23
Commit: ce481db1bf3b556c7ebe7851546c9425d0b5c192
Parents: d0f3327
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Apr 30 19:03:53 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Apr 30 19:03:53 2017 +0200

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


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ce481db1/src/Appender/RollingFileAppender.cs
----------------------------------------------------------------------
diff --git a/src/Appender/RollingFileAppender.cs b/src/Appender/RollingFileAppender.cs
index 63ffaeb..7554bf4 100644
--- a/src/Appender/RollingFileAppender.cs
+++ b/src/Appender/RollingFileAppender.cs
@@ -1493,11 +1493,24 @@ namespace log4net.Appender
 						string archiveFileBaseName = baseFileName;
 						if (!m_staticLogFileName)
 						{
+                                                    if (m_preserveLogFileNameExtension)
+                                                    {
+                                                        string extension = Path.GetExtension(archiveFileBaseName);
+                                                        string baseName = Path.GetFileNameWithoutExtension(archiveFileBaseName);
+							int lastDotIndex = baseName.LastIndexOf(".");
+							if (lastDotIndex >= 0)
+							{
+								archiveFileBaseName = baseName.Substring(0, lastDotIndex) + extension;
+							}
+                                                    }
+                                                    else
+                                                    {
 							int lastDotIndex = archiveFileBaseName.LastIndexOf(".");
 							if (lastDotIndex >= 0) 
 							{
 								archiveFileBaseName = archiveFileBaseName.Substring(0, lastDotIndex);
 							}
+                                                    }
 						}
 
 						// Delete the archive file