logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpsen...@apache.org
Subject svn commit: r1486596 - /logging/log4net/trunk/src/Appender/RollingFileAppender.cs
Date Mon, 27 May 2013 12:45:46 GMT
Author: dpsenner
Date: Mon May 27 12:45:46 2013
New Revision: 1486596

URL: http://svn.apache.org/r1486596
Log:
LOG4NET-378 fixed a problem where rolled log files get overwritten when the application is
restarted

The cause is that InitializeFromOneFile() does not succesfully detect the filenames.

Modified:
    logging/log4net/trunk/src/Appender/RollingFileAppender.cs

Modified: logging/log4net/trunk/src/Appender/RollingFileAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/RollingFileAppender.cs?rev=1486596&r1=1486595&r2=1486596&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/RollingFileAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/RollingFileAppender.cs Mon May 27 12:45:46 2013
@@ -904,7 +904,10 @@ namespace log4net.Appender
 			// Only look for files in the current roll point
 			if (m_rollDate && !m_staticLogFileName)
 			{
-				if (! curFileName.StartsWith(CombinePath(baseFile, m_dateTime.Now.ToString(m_datePattern,
System.Globalization.DateTimeFormatInfo.InvariantInfo))))
+				string date = m_dateTime.Now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
+				string prefix = m_preserveLogFileNameExtension ? Path.GetFileNameWithoutExtension(baseFile)
+ date : baseFile + date;
+				string suffix = m_preserveLogFileNameExtension ? Path.GetExtension(baseFile) : "";
+				if (!curFileName.StartsWith(prefix) || !curFileName.EndsWith(suffix))
 				{
 					LogLog.Debug(declaringType, "Ignoring file ["+curFileName+"] because it is from a different
date period");
 					return;



Mime
View raw message