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 Dominik Psenner <dp...@gmail.com> on 2013/01/22 14:41:04 UTC

[PATCH 0 of 5 ] LOG4NET-27: Hans Meiers RFA patches

I pasted the patched files into a series of patches and bomb them to the mailing list for eassier review.

[PATCH 3 of 5] Step 3: modifications without affecting existing code

Posted by Dominik Psenner <dp...@gmail.com>.
* some trivial changes in visibility, regions etc.
* additional functions, properties, members that aren't yet used from existing code.
* NextCheckDate -> GetRollDateTimeRelative:
  Function works identically if called with relativePeriod==1. Existing code does this.
  Additionally any count of positive or negative period jumps can be calculated.
* Fully isolated getting last write time in a function GetLastWriteTime
* Split CombinePath into a static version and a member function to call it. Needed
  to allow implementing and testing one of the new functions as static function.
  That new, static function uses CombinePath so i needed a static version.

diff -r 76c5f9136b8f -r 569e06c6cfb3 src/Appender/RollingFileAppender.cs
--- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:24 2013 +0100
+++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:43 2013 +0100
@@ -169,10 +169,6 @@
 			Composite	= 3
 		}
 
-		#endregion
-
-		#region Protected Enums
-
 		/// <summary>
 		/// The code assumes that the following 'time' constants are in a increasing sequence.
 		/// </summary>
@@ -181,7 +177,7 @@
 		/// The code assumes that the following 'time' constants are in a increasing sequence.
 		/// </para>
 		/// </remarks>
-		protected enum RollPoint
+		public enum RollPoint
 		{
 			/// <summary>
 			/// Roll the log not based on the date
@@ -219,7 +215,7 @@
 			TopOfMonth			= 5
 		}
 
-		#endregion Protected Enums
+		#endregion Public Enums
 
 		#region Public Instance Constructors
 
@@ -339,6 +335,35 @@
 		}
 
 		/// <summary>
+		/// Gets or sets the maximum number of periods to keep backups for.
+		/// </summary>
+		/// <value>
+		/// The maximum number of periods to keep backups for.
+		/// </value>
+		/// <remarks>
+		/// <para>
+		/// The value refers to the count of periods backups shall be kept for. Any 
+		/// backups that are older than MaxDateRollBackups * Period get deleted,
+		/// regardless whether or how many backups exist younger than this exist. 
+		/// </para>
+		/// <para>
+		/// Example: If set to 10 and roll pattern is daily everything older than 10 
+		/// days gets deleted.  
+		/// </para>
+		/// <para>
+		/// If set to zero, then there will be no time roll backup files.
+		/// </para>
+		/// <para>
+		/// If a negative number is supplied then no deletions will be made.
+		/// </para>
+		/// </remarks>
+		public int MaxDateRollBackups
+		{
+			get { return m_maxDateRollBackups; }
+			set { m_maxDateRollBackups = value; }
+		}
+
+		/// <summary>
 		/// Gets or sets the maximum size that the output file is allowed to reach
 		/// before being rolled over to backup files.
 		/// </summary>
@@ -598,7 +623,7 @@
 				if (n >= m_nextCheck)
 				{
 					m_now = n;
-					m_nextCheck = NextCheckDate(m_now, m_rollPoint);
+					m_nextCheck = GetRollDateTimeRelative(m_now, m_rollPoint, 1);
 
 					RollOverTime(true);
 				}
@@ -797,18 +822,7 @@
 					DateTime last;
 					using(SecurityContext.Impersonate(this))
 					{
-#if !NET_1_0 && !CLI_1_0 && !NETCF
-						if (DateTimeStrategy is UniversalDateTime)
-						{
-							last = System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
-						}
-						else
-						{
-#endif
-							last = System.IO.File.GetLastWriteTime(m_baseFileName);
-#if !NET_1_0 && !CLI_1_0 && !NETCF
-						}
-#endif
+						last = GetLastWriteTime(m_baseFileName);
 					}
 					LogLog.Debug(declaringType, "["+last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"] vs. ["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"]");
 
@@ -824,6 +838,29 @@
 		}
 
 		/// <summary>
+		/// Gets the last write time for the file given
+		/// </summary>
+		/// <param name="fileName">the path to the file</param>
+		/// <returns>the time of last write</returns>
+		private DateTime GetLastWriteTime(string fileName)
+		{
+			DateTime last;
+#if !NET_1_0 && !CLI_1_0 && !NETCF
+			if (DateTimeStrategy is UniversalDateTime)
+			{
+				last = System.IO.File.GetLastWriteTimeUtc(fileName);
+			}
+			else
+			{
+#endif
+				last = System.IO.File.GetLastWriteTime(fileName);
+#if !NET_1_0 && !CLI_1_0 && !NETCF
+			}
+#endif
+			return last;
+		}
+
+		/// <summary>
 		/// Initializes based on existing conditions at time of <see cref="ActivateOptions"/>.
 		/// </summary>
 		/// <remarks>
@@ -1036,7 +1073,7 @@
 			for(int i = (int)RollPoint.TopOfMinute; i <= (int)RollPoint.TopOfMonth; i++)
 			{
 				// Get string representation of next pattern
-				string r1 = NextCheckDate(s_date1970, (RollPoint)i).ToString(datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
+				string r1 = GetRollDateTimeRelative(s_date1970, (RollPoint)i, 1).ToString(datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
 
 				LogLog.Debug(declaringType, "Type = ["+i+"], r0 = ["+r0+"], r1 = ["+r1+"]");
 
@@ -1090,7 +1127,7 @@
 				}
 
 				// next line added as this removes the name check in rollOver
-				m_nextCheck = NextCheckDate(m_now, m_rollPoint);
+				m_nextCheck = GetRollDateTimeRelative(m_now, m_rollPoint, 1);
 			}
 			else
 			{
@@ -1131,15 +1168,29 @@
 		#region Roll File
 
 		/// <summary>
-		///
+		/// Convenience member function used to call its static equivalent.
 		/// </summary>
-		/// <param name="path1"></param>
-		/// <param name="path2">.1, .2, .3, etc.</param>
-		/// <returns></returns>
-		private string CombinePath(string path1, string path2)
+		/// <param name="path1">unindexed raw log file path</param>
+		/// <param name="path2">date and/or size roll index. .1, .20121224, .20121224.2 or something like that</param>
+		/// <returns>the combined path</returns>
+		protected string CombinePath(string path1, string path2)
+		{
+			return CombinePath(path1, path2, m_preserveLogFileNameExtension);
+		}
+
+		/// <summary>
+		/// Combines a path from the given elements such that if preserveLogFileNameExtension is
+		/// set to true the date and/or size roll index given in path2 gets inserted or appended correctly
+		/// into/behind the unindexed path given in path1
+		/// </summary>
+		/// <param name="path1">unindexed raw log file path</param>
+		/// <param name="path2">date and/or size roll index. .1, .20121224, .20121224.2 or something like that</param>
+		/// <param name="preserveLogFileNameExtension">preserve the log file extension (insert before) or not (append)</param>
+		/// <returns>the combined path</returns>
+		protected static string CombinePath(string path1, string path2, bool preserveLogFileNameExtension)
 		{
 			string extension = Path.GetExtension(path1);
-			if (m_preserveLogFileNameExtension && extension.Length > 0)
+			if (preserveLogFileNameExtension && extension.Length > 0)
 			{
 				return Path.Combine(Path.GetDirectoryName(path1), Path.GetFileNameWithoutExtension(path1) + path2 + extension);
 			}
@@ -1212,6 +1263,83 @@
 		}
 
 		/// <summary>
+		/// Deletes all files that are outdated considering m_maxDateRollBackups. 
+		/// </summary>
+		protected void DeleteOutdatedFiles()
+		{
+			if (m_maxDateRollBackups >= 0)
+			{
+				// find all matching files. 
+				// we don't care about roll indexes or roll date patterns that cannot have been created by us.
+				// we just handle each file that has the matching base name and the matching extension.
+				string[] fileNames = Directory.GetFiles(Path.GetDirectoryName(File), Path.GetFileNameWithoutExtension(CombinePath(m_baseFileName, ".*", m_preserveLogFileNameExtension)));
+				ArrayList fileDeleteList = GetFileDeleteList(fileNames, DateTimeStrategy.Now, m_baseFileName, m_datePattern, m_rollPoint,
+					m_maxDateRollBackups, m_preserveLogFileNameExtension);
+				foreach (string fileName in fileDeleteList)
+				{
+					DeleteFile(fileName);
+				}
+			}
+
+		}
+
+		/// <summary>
+		/// Gets a list of files to delete considering the rollPoint, maxDateRollBackups, 
+		/// the given current time now, the baseFile name and the datePattern given by 
+		/// filtering the file name list given with a generated positive (keep) list.
+		/// Files in fileNames that don't appear in the internal keep pattern list get listed in the 
+		/// file list returned and can be in turn deleted by the caller.
+		/// </summary>
+		/// <param name="fileNames">list of file names to check for deletion</param>
+		/// <param name="now">the point of time to be used for deciding whether files are outdated or not</param>
+		/// <param name="baseFile">the base file name of all log files</param>
+		/// <param name="datePattern">the date pattern to be used</param>
+		/// <param name="rollPoint">the roll point to be used</param>
+		/// <param name="maxDateRollBackups">the maximum number of date roll backups</param>
+		/// <param name="preserveLogFileNameExtension">preserve log file extensions (insert date/size index) or not (append date/size index)</param>
+		/// <returns>list of files to be deleted as a filtering result on fileNames at input</returns>
+		protected static ArrayList GetFileDeleteList(string[] fileNames, DateTime now, string baseFile, string datePattern, RollPoint rollPoint, int maxDateRollBackups, bool preserveLogFileNameExtension)
+		{
+			ArrayList list = new ArrayList();
+			if (maxDateRollBackups >= 0)
+			{
+				// remark: we cannot use file write time here because
+				//		 * file might have been touched somehow after period
+				//		 * file gets written to after period if a footer is configured and thus been added when file is closed
+				// therefore we now create a positive pattern list, match each file name found against it and if
+				// it doesn't match delete the file
+
+				string[] positiveList = new string[maxDateRollBackups + 1];
+				for (int i = 0; i <= maxDateRollBackups; i++)
+				{
+					DateTime periodStart = GetRollDateTimeRelative(now, rollPoint, -i);
+					string periodPattern = periodStart.ToString(datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo) + "*";
+					string periodPatternPath = CombinePath(baseFile, periodPattern, preserveLogFileNameExtension);
+					positiveList[i] = Path.GetFileName(periodPatternPath).Split(new Char[] { '*' })[0];
+				}
+
+				foreach (string fileName in fileNames)
+				{
+					string fn = Path.GetFileName(fileName);
+					bool keep = false;
+					foreach (string fileStart in positiveList)
+					{
+						if (fn.StartsWith(fileStart))
+						{
+							keep = true;
+							break;
+						}
+					}
+					if (!keep)
+					{
+						list.Add(fileName);
+					}
+				}
+			}
+			return list;
+		}
+
+		/// <summary>
 		/// Renames file <paramref name="fromFile"/> to file <paramref name="toFile"/>.
 		/// </summary>
 		/// <param name="fromFile">Name of existing file to roll.</param>
@@ -1466,90 +1594,94 @@
 			}
 		}
 
-		#endregion
-
-		#region NextCheckDate
-
 		/// <summary>
-		/// Get the start time of the next window for the current rollpoint
+		/// Get the beginning of the relativePeriod-th following or preceeding period relative to the 
+		/// the period that contains the given dateTime.
 		/// </summary>
-		/// <param name="currentDateTime">the current date</param>
+		/// <param name="dateTime">the date</param>
 		/// <param name="rollPoint">the type of roll point we are working with</param>
-		/// <returns>the start time for the next roll point an interval after the currentDateTime date</returns>
+		/// <param name="relativePeriod">
+		/// the number of the period relative to the dateTime given. 
+		/// 0 means the beginning of the period that contains the given dateTime.
+		/// 1 means the beginning of the period following the period that contains the given dateTime.
+		/// -7 means the beginning of the 7th period before the period that contains the given dateTime.
+		/// </param>
+		/// <returns>the beginning of the period requested.</returns>
 		/// <remarks>
 		/// <para>
-		/// Returns the date of the next roll point after the currentDateTime date passed to the method.
+		/// Get the beginning of the relativePeriod-th following or preceeding period relative to the 
+		/// the period that contains the given dateTime.
 		/// </para>
 		/// <para>
 		/// The basic strategy is to subtract the time parts that are less significant
 		/// than the rollpoint from the current time. This should roll the time back to
-		/// the start of the time window for the current rollpoint. Then we add 1 window
-		/// worth of time and get the start time of the next window for the rollpoint.
+		/// the start of the time window for the current rollpoint. Then we add relativePeriod periods
+		/// worth of time and get the beginning of the period requested.
 		/// </para>
 		/// </remarks>
-		protected DateTime NextCheckDate(DateTime currentDateTime, RollPoint rollPoint)
+		protected static DateTime GetRollDateTimeRelative(DateTime dateTime, RollPoint rollPoint, int relativePeriod)
 		{
 			// Local variable to work on (this does not look very efficient)
-			DateTime current = currentDateTime;
+			DateTime result = dateTime;
 
 			// Do slightly different things depending on what the type of roll point we want.
 			switch(rollPoint)
 			{
 				case RollPoint.TopOfMinute:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(1);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(relativePeriod);
 					break;
 
 				case RollPoint.TopOfHour:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(-current.Minute);
-					current = current.AddHours(1);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(-result.Minute);
+					result = result.AddHours(relativePeriod);
 					break;
 
 				case RollPoint.HalfDay:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(-current.Minute);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(-result.Minute);
 
-					if (current.Hour < 12)
+					if (result.Hour < 12)
 					{
-						current = current.AddHours(12 - current.Hour);
+						result = result.AddHours(-result.Hour);
 					}
 					else
 					{
-						current = current.AddHours(-current.Hour);
-						current = current.AddDays(1);
+						result = result.AddHours(12-result.Hour);
 					}
+					result = result.AddHours(12 * relativePeriod);
 					break;
 
 				case RollPoint.TopOfDay:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(-current.Minute);
-					current = current.AddHours(-current.Hour);
-					current = current.AddDays(1);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(-result.Minute);
+					result = result.AddHours(-result.Hour);
+					result = result.AddDays(relativePeriod);
 					break;
 
 				case RollPoint.TopOfWeek:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(-current.Minute);
-					current = current.AddHours(-current.Hour);
-					current = current.AddDays(7 - (int)current.DayOfWeek);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(-result.Minute);
+					result = result.AddHours(-result.Hour);
+					result = result.AddDays(7*relativePeriod - (int)result.DayOfWeek);
 					break;
 
 				case RollPoint.TopOfMonth:
-					current = current.AddMilliseconds(-current.Millisecond);
-					current = current.AddSeconds(-current.Second);
-					current = current.AddMinutes(-current.Minute);
-					current = current.AddHours(-current.Hour);
-					current = current.AddDays(1 - current.Day); /* first day of month is 1 not 0 */
-					current = current.AddMonths(1);
+					result = result.AddMilliseconds(-result.Millisecond);
+					result = result.AddSeconds(-result.Second);
+					result = result.AddMinutes(-result.Minute);
+					result = result.AddHours(-result.Hour);
+					result = result.AddDays(1 - result.Day); /* first day of month is 1 not 0 */
+					result = result.AddMonths(relativePeriod);
 					break;
 			}
-			return current;
+			return result;
 		}
 
 		#endregion
@@ -1612,6 +1744,11 @@
 		private int m_countDirection = -1;
 
 		/// <summary>
+		/// There is zero backup files by default
+		/// </summary>
+		private int m_maxDateRollBackups = 0;
+
+		/// <summary>
 		/// The rolling mode used in this appender.
 		/// </summary>
 		private RollingMode m_rollingStyle = RollingMode.Composite;

Re: [PATCH 4 of 5] Step 4: use the new functionality

Posted by Dominik Psenner <dp...@gmail.com>.
On 01/22/2013 02:41 PM, Dominik Psenner wrote:
> diff -r 569e06c6cfb3 -r c4b727dc790c src/Appender/RollingFileAppender.cs
> --- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:43 2013 +0100
> +++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:58 2013 +0100
> @@ -835,6 +835,11 @@
>   					}
>   				}
>   			}
> +
> +			if (m_rollDate)
> +			{
> +				DeleteOutdatedFiles();
> +			}
>   		}
>   
>   		/// <summary>
> @@ -1243,12 +1248,18 @@
>   				{
>   					string from = CombinePath(File, "." + i);
>   					string to = CombinePath(m_scheduledFilename, "." + i);
> -					RollFile(from, to);
> +					if (FileExists(from)) // to avoid file not exists warning because that's legal here
> +					{
> +						RollFile(from, to);
> +					}
>   				}
>   
>   				RollFile(File, m_scheduledFilename);
>   			}
>   
> +			//Now we delete files too old to keep (see m_maxDateRollBackups)
> +			DeleteOutdatedFiles();
> +
>   			//We've cleared out the old date and are ready for the new
>   			m_curSizeRollBackups = 0;
>   
This patch does not make sense without the previous patch. So the 
functionality is basically hidden in the previous patch that claims to 
be doing nothing. I'm aborting the review here. Please split the patches 
into as many pieces as needed so that they are easily review-able. That 
would be great!

[PATCH 4 of 5] Step 4: use the new functionality

Posted by Dominik Psenner <dp...@gmail.com>.
diff -r 569e06c6cfb3 -r c4b727dc790c src/Appender/RollingFileAppender.cs
--- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:43 2013 +0100
+++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:58 2013 +0100
@@ -835,6 +835,11 @@
 					}
 				}
 			}
+
+			if (m_rollDate)
+			{
+				DeleteOutdatedFiles();
+			}
 		}
 
 		/// <summary>
@@ -1243,12 +1248,18 @@
 				{
 					string from = CombinePath(File, "." + i);
 					string to = CombinePath(m_scheduledFilename, "." + i);
-					RollFile(from, to);
+					if (FileExists(from)) // to avoid file not exists warning because that's legal here
+					{
+						RollFile(from, to);
+					}
 				}
 
 				RollFile(File, m_scheduledFilename);
 			}
 
+			//Now we delete files too old to keep (see m_maxDateRollBackups)
+			DeleteOutdatedFiles();
+
 			//We've cleared out the old date and are ready for the new
 			m_curSizeRollBackups = 0;
 

Re: [PATCH 2 of 5] Step 2: bugfix

Posted by Dominik Psenner <dp...@gmail.com>.
What are the effects of this bug? It is not yet reported as an issue, is it?

On 01/22/2013 02:41 PM, Dominik Psenner wrote:
> In RollOverIfDateBoundaryCrossing preserveLogFileExtension wasn't respected.
>
> diff -r dc18d71a5304 -r 76c5f9136b8f src/Appender/RollingFileAppender.cs
> --- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:05 2013 +0100
> +++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:24 2013 +0100
> @@ -814,7 +814,7 @@
>   
>   					if (!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo))))
>   					{
> -						m_scheduledFilename = m_baseFileName + last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
> +						m_scheduledFilename = CombinePath(m_baseFileName, last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
>   						LogLog.Debug(declaringType, "Initial roll over to ["+m_scheduledFilename+"]");
>   						RollOverTime(false);
>   						LogLog.Debug(declaringType, "curSizeRollBackups after rollOver at ["+m_curSizeRollBackups+"]");

[PATCH 2 of 5] Step 2: bugfix

Posted by Dominik Psenner <dp...@gmail.com>.
In RollOverIfDateBoundaryCrossing preserveLogFileExtension wasn't respected.

diff -r dc18d71a5304 -r 76c5f9136b8f src/Appender/RollingFileAppender.cs
--- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:05 2013 +0100
+++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:24 2013 +0100
@@ -814,7 +814,7 @@
 
 					if (!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo))))
 					{
-						m_scheduledFilename = m_baseFileName + last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
+						m_scheduledFilename = CombinePath(m_baseFileName, last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
 						LogLog.Debug(declaringType, "Initial roll over to ["+m_scheduledFilename+"]");
 						RollOverTime(false);
 						LogLog.Debug(declaringType, "curSizeRollBackups after rollOver at ["+m_curSizeRollBackups+"]");

Re: [PATCH 5 of 5] Step 5: tests

Posted by Dominik Psenner <dp...@gmail.com>.
On 01/22/2013 02:41 PM, Dominik Psenner wrote:
> diff -r c4b727dc790c -r 09c42c61e2db tests/src/Appender/RollingFileAppenderTest.cs
> --- a/tests/src/Appender/RollingFileAppenderTest.cs	Tue Jan 22 14:31:58 2013 +0100
> +++ b/tests/src/Appender/RollingFileAppenderTest.cs	Tue Jan 22 14:37:21 2013 +0100
> @@ -1874,12 +1874,110 @@
>   		{
>   		}
>   
> +        /// <summary>
> +        ///
> +        /// </summary>
> +        [Test]
> +        public void TestGetFileDeleteList1()
> +        {
> +            string[] files = {   "C:\\foo\\log.201302.log", "C:\\foo\\log.201302.1.log", "C:\\foo\\log.201302.2.log",
> +                                 "C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
> +                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",
> +                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
> +            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyyMM",
> +                RollingFileAppender.RollPoint.TopOfMonth, 2, true);
> +            string[] expected = { "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
> +            Assert.AreEqual(expected, actual);
> +        }
>   
> -		//
> +        /// <summary>
> +        ///
> +        /// </summary>
> +        [Test]
> +        public void TestGetFileDeleteList2()
> +        {
> +            string[] files = {   "C:\\foo\\log.201302.log", "C:\\foo\\log.201302.1.log", "C:\\foo\\log.201302.2.log",
> +                                 "C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
> +                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",
> +                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
> +            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyyMM",
> +                RollingFileAppender.RollPoint.TopOfMonth, 0, true);
> +            string[] expected = {"C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
> +                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",
> +                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
> +            Assert.AreEqual(expected, actual);
> +        }
> +
> +        /// <summary>
> +        ///
> +        /// </summary>
> +        [Test]
> +        public void TestGetFileDeleteList3()
> +        {
> +            string[] files = {   "C:\\foo\\log.log.2013.2", "C:\\foo\\log.log.2013.2.1", "C:\\foo\\log.log.2013.2.2",
> +                                 "C:\\foo\\log.log.2013.1", "C:\\foo\\log.log.2013.1.1", "C:\\foo\\log.log.2013.1.2",
> +                                 "C:\\foo\\log.log.2012.12", "C:\\foo\\log.log.2012.12.1", "C:\\foo\\log.log.2012.12.2",
> +                                 "C:\\foo\\log.log.2012.11", "C:\\foo\\log.log.2012.11.1", "C:\\foo\\log.log.2012.11.2" };
> +            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyy.M",
> +                RollingFileAppender.RollPoint.TopOfMonth, 2, false);
> +            string[] expected = { "C:\\foo\\log.log.2012.11", "C:\\foo\\log.log.2012.11.1", "C:\\foo\\log.log.2012.11.2" };
> +            Assert.AreEqual(expected, actual);
> +        }
> +
> +        /// <summary>
> +        ///
> +        /// </summary>
> +        [Test]
> +        public void TestGetFileDeleteList4()
> +        {
> +            string[] files = {   "C:\\foo\\log.2.2013.log", "C:\\foo\\log.2.2013.1.log", "C:\\foo\\log.2.2013.2.log",
> +                                 "C:\\foo\\log.1.2013.log", "C:\\foo\\log.1.2013.1.log", "C:\\foo\\log.1.2013.2.log",
> +                                 "C:\\foo\\log.12.2012.log", "C:\\foo\\log.12.2012.1.log", "C:\\foo\\log.12.2012.2.log" };
> +            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".M.yyyy",
> +                RollingFileAppender.RollPoint.TopOfMonth, 0, true);
> +            string[] expected = { "C:\\foo\\log.1.2013.log", "C:\\foo\\log.1.2013.1.log", "C:\\foo\\log.1.2013.2.log",
> +                                  "C:\\foo\\log.12.2012.log", "C:\\foo\\log.12.2012.1.log", "C:\\foo\\log.12.2012.2.log"};
> +            Assert.AreEqual(expected, actual);
> +        }
> +
> +        //
>   		// Helper functions to dig into the appender
>   		//
> +        protected class TestDateTime : RollingFileAppender.IDateTime
> +        {
> +            public TestDateTime(DateTime dt)
> +            {
> +                m_Now = dt;
> +            }
>   
> -		private static ArrayList GetExistingFiles(string baseFilePath)
> +            #region IDateTime Members
> +
> +            public DateTime Now
> +            {
> +                get { return m_Now; }
> +            }
> +
> +            #endregion
> +
> +            private DateTime m_Now;
> +        }
> +
> +        protected static string[] GetFileDeleteList(string[] fileNames, DateTime dateTime, string baseFile,
> +            string datePattern, RollingFileAppender.RollPoint rollPoint, int maxDateRollBackups, bool preserveLogFileNameExtension)
> +        {
> +            RollingFileAppender appender = new RollingFileAppender();
> +            ArrayList list = (ArrayList)Utils.InvokeMethod(appender, "GetFileDeleteList", fileNames, dateTime, baseFile,
> +                datePattern, rollPoint, maxDateRollBackups, preserveLogFileNameExtension);
> +            string[] rv = new string[list.Count];
> +            int i=0;
> +            foreach(string s in list)
> +            {
> +                rv[i++]=s;
> +            }
> +            return rv;
> +        }
> +
> +        private static ArrayList GetExistingFiles(string baseFilePath)
>   		{
>   			RollingFileAppender appender = new RollingFileAppender();
>   			appender.SecurityContext = NullSecurityContext.Instance;
> @@ -1921,9 +2019,9 @@
>   					throw new Exception("Unexpected Environment.NewLine.Length");
>   			}
>   		}
> -	}
> +    }
>   
> -	[TestFixture]
> +    [TestFixture]
>   	public class RollingFileAppenderSubClassTest : RollingFileAppender
>   	{
>   		[Test]
Regression tests are always great. Unfortunately I cannot determine if 
these are sensible or not since the patch is too big. It would make 
sense to split the previous patches into chunks that come together with 
all the tests.

[PATCH 5 of 5] Step 5: tests

Posted by Dominik Psenner <dp...@gmail.com>.
diff -r c4b727dc790c -r 09c42c61e2db tests/src/Appender/RollingFileAppenderTest.cs
--- a/tests/src/Appender/RollingFileAppenderTest.cs	Tue Jan 22 14:31:58 2013 +0100
+++ b/tests/src/Appender/RollingFileAppenderTest.cs	Tue Jan 22 14:37:21 2013 +0100
@@ -1874,12 +1874,110 @@
 		{
 		}
 
+        /// <summary>
+        /// 
+        /// </summary>
+        [Test]
+        public void TestGetFileDeleteList1()
+        {
+            string[] files = {   "C:\\foo\\log.201302.log", "C:\\foo\\log.201302.1.log", "C:\\foo\\log.201302.2.log", 
+                                 "C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
+                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",  
+                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
+            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyyMM", 
+                RollingFileAppender.RollPoint.TopOfMonth, 2, true);
+            string[] expected = { "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
+            Assert.AreEqual(expected, actual);
+        }
 
-		//
+        /// <summary>
+        /// 
+        /// </summary>
+        [Test]
+        public void TestGetFileDeleteList2()
+        {
+            string[] files = {   "C:\\foo\\log.201302.log", "C:\\foo\\log.201302.1.log", "C:\\foo\\log.201302.2.log", 
+                                 "C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
+                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",  
+                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
+            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyyMM",
+                RollingFileAppender.RollPoint.TopOfMonth, 0, true);
+            string[] expected = {"C:\\foo\\log.201301.log", "C:\\foo\\log.201301.1.log", "C:\\foo\\log.201301.2.log",
+                                 "C:\\foo\\log.201212.log", "C:\\foo\\log.201212.1.log", "C:\\foo\\log.201212.2.log",  
+                                 "C:\\foo\\log.201211.log", "C:\\foo\\log.201211.1.log", "C:\\foo\\log.201211.2.log" };
+            Assert.AreEqual(expected, actual);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [Test]
+        public void TestGetFileDeleteList3()
+        {
+            string[] files = {   "C:\\foo\\log.log.2013.2", "C:\\foo\\log.log.2013.2.1", "C:\\foo\\log.log.2013.2.2", 
+                                 "C:\\foo\\log.log.2013.1", "C:\\foo\\log.log.2013.1.1", "C:\\foo\\log.log.2013.1.2",
+                                 "C:\\foo\\log.log.2012.12", "C:\\foo\\log.log.2012.12.1", "C:\\foo\\log.log.2012.12.2",  
+                                 "C:\\foo\\log.log.2012.11", "C:\\foo\\log.log.2012.11.1", "C:\\foo\\log.log.2012.11.2" };
+            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".yyyy.M",
+                RollingFileAppender.RollPoint.TopOfMonth, 2, false);
+            string[] expected = { "C:\\foo\\log.log.2012.11", "C:\\foo\\log.log.2012.11.1", "C:\\foo\\log.log.2012.11.2" };
+            Assert.AreEqual(expected, actual);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [Test]
+        public void TestGetFileDeleteList4()
+        {
+            string[] files = {   "C:\\foo\\log.2.2013.log", "C:\\foo\\log.2.2013.1.log", "C:\\foo\\log.2.2013.2.log", 
+                                 "C:\\foo\\log.1.2013.log", "C:\\foo\\log.1.2013.1.log", "C:\\foo\\log.1.2013.2.log",
+                                 "C:\\foo\\log.12.2012.log", "C:\\foo\\log.12.2012.1.log", "C:\\foo\\log.12.2012.2.log" };
+            string[] actual = GetFileDeleteList(files, DateTime.Parse("2013/02/15"), "C:\\foo\\log.log", ".M.yyyy",
+                RollingFileAppender.RollPoint.TopOfMonth, 0, true);
+            string[] expected = { "C:\\foo\\log.1.2013.log", "C:\\foo\\log.1.2013.1.log", "C:\\foo\\log.1.2013.2.log",
+                                  "C:\\foo\\log.12.2012.log", "C:\\foo\\log.12.2012.1.log", "C:\\foo\\log.12.2012.2.log"};
+            Assert.AreEqual(expected, actual);
+        }
+
+        //
 		// Helper functions to dig into the appender
 		//
+        protected class TestDateTime : RollingFileAppender.IDateTime
+        {
+            public TestDateTime(DateTime dt)
+            {
+                m_Now = dt;
+            }
 
-		private static ArrayList GetExistingFiles(string baseFilePath)
+            #region IDateTime Members
+
+            public DateTime Now
+            {
+                get { return m_Now; }
+            }
+
+            #endregion
+
+            private DateTime m_Now;
+        }
+
+        protected static string[] GetFileDeleteList(string[] fileNames, DateTime dateTime, string baseFile,
+            string datePattern, RollingFileAppender.RollPoint rollPoint, int maxDateRollBackups, bool preserveLogFileNameExtension)
+        {
+            RollingFileAppender appender = new RollingFileAppender();
+            ArrayList list = (ArrayList)Utils.InvokeMethod(appender, "GetFileDeleteList", fileNames, dateTime, baseFile,
+                datePattern, rollPoint, maxDateRollBackups, preserveLogFileNameExtension);
+            string[] rv = new string[list.Count];
+            int i=0;
+            foreach(string s in list)
+            {
+                rv[i++]=s;
+            }
+            return rv;
+        }
+
+        private static ArrayList GetExistingFiles(string baseFilePath)
 		{
 			RollingFileAppender appender = new RollingFileAppender();
 			appender.SecurityContext = NullSecurityContext.Instance;
@@ -1921,9 +2019,9 @@
 					throw new Exception("Unexpected Environment.NewLine.Length");
 			}
 		}
-	}
+    }
 
-	[TestFixture]
+    [TestFixture]
 	public class RollingFileAppenderSubClassTest : RollingFileAppender
 	{
 		[Test]

Re: [PATCH 1 of 5] Step 1: refactoring

Posted by Hans Meier <h....@arcor.de>.
Hi Dominik,
Hi all,

here it is, I split the path from 2->3 into 9 microsteps easily 
understandable now:

step 2.1:
* made enum RollPoint public for easy access in tests
* modified regions accordingly
* removed region enclosing function NextCheckDate. Function is a "Roll 
File" function and thus can live in this region
=> no functionality changes, right?

step 2.2:
* extracted function GetLastWriteTime (not really necessary, but things 
look better this way. just a by-product.)
=> no functionality changes, right?

step 2.3:
* made CombinePath a static function by handing over the only member 
variable formerly used therein (m_preserveLogFileNameExtension). Needed 
for implementing another static function later using this function
* added a member CombinePath just calling static CombinePath and handing 
over m_preserveLogFileNameExtension. Thus callers code hasn't to be changed.
=> no functionality changes, right?

step 2.4:
* renamed function NextCheckDate to GetRollDateTimeRelative and added an 
int parameter relativePeriod. Intention: enable this function to 
calculate not only the next roll point (with relativePeriod set to 1) 
but also the n-th roll point in past or future
* Parameter relativePeriod isn't yet used internally, so functionality 
hasn't changed yet.
* all calls to GetRollDateTimeRelative set relativePeriod to 1 because 
these calls want to get the NEXT roll point.
=> no functionality changes, right?

step 2.5:
* renamed parameter currentDateTime to dateTime in 
GetRollDateTimeRelative. Parameter is just any dateTime so we shouldn't 
pretend to be current.
=> no functionality changes, right?

step 2.6:
* renamed local variable current to result in function 
GetRollDateTimeRelative. It is the return value. It hasn't to be 
something current. So we shouldn't name it "current".
=> no functionality changes, right?

step 2.7:
* make use of parameter relativePeriod. If set to one (see step 2.4) no 
functionality changes for the only callers we have so far.
* the only lines where change isn't totally trivial is case 
RollPoint.HalfDay but with a litte bit of brain sports it still does the 
same for relativePeriod==1.
=> no functionality changes, right?

step 2.8:
* added property and member var maxDateRollBackups without accessing it 
from anywhere yet.
=> no functionality changes, right?

step 3: (as sent before)
* added static function GetFileDeleteList not yet called from anywhere
* added member function DeleteOutdatedFiles not yet called from 
anywhere, using GetFileDeleteList and m_maxDateRollBackups
=> no functionality changes, right?

Remarks:
* when DeleteOutdatedFiles will get called from the right locations the 
new functionality will exist (see step 4)
* for GetFileDeleteList I added some new test cases
* DeleteOutdatedFiles is relatively simple, so I didn't add tests.
* DeleteOutdatedFiles MIGHT delete some files that we didn't create if 
files are found which have names too similar to our log file pattern. 
This can be addressed isolated in these two functions later if 
considered to be unacceptable

Questions welcome!

Cheers
Hans



Am 23.01.2013 08:38, schrieb Dominik Psenner:
>> Do you expect any response from other devs?
>
> No.
>
>> In case you do, we practice CTR (Commit then review). If you are happy
>> with the patches, then just apply them to the code. If you are not
>> happy / in doubt, get to the ML. No need to wait for a second
>> confirmation :-)
>
> I'm expecting feedback from the writer of the patch. There is too much background noise of unrelated changes in the patch and I hope
> that untangling the important parts could resolve LOG4NET-27. And last but not least I'm trying to get other people involved. :-)
>
> Cheers,
> Dominik
>
>
>

RE: [PATCH 1 of 5] Step 1: refactoring

Posted by Dominik Psenner <dp...@gmail.com>.
>Do you expect any response from other devs?

No.

>In case you do, we practice CTR (Commit then review). If you are happy
>with the patches, then just apply them to the code. If you are not
>happy / in doubt, get to the ML. No need to wait for a second
>confirmation :-)

I'm expecting feedback from the writer of the patch. There is too much background noise of unrelated changes in the patch and I hope
that untangling the important parts could resolve LOG4NET-27. And last but not least I'm trying to get other people involved. :-)

Cheers,
Dominik


Re: [PATCH 1 of 5] Step 1: refactoring

Posted by Christian Grobmeier <gr...@gmail.com>.
On Tue, Jan 22, 2013 at 2:46 PM, Dominik Psenner <dp...@gmail.com> wrote:
> Quite a large patch, but looks sensible.

Do you expect any response from other devs?

In case you do, we practice CTR (Commit then review). If you are happy
with the patches, then just apply them to the code. If you are not
happy / in doubt, get to the ML. No need to wait for a second
confirmation :-)

Cheers
Christian


>
>>-----Original Message-----
>>From: Dominik Psenner [mailto:dpsenner@gmail.com]
>>Sent: Tuesday, January 22, 2013 2:41 PM
>>To: log4net-dev@logging.apache.org
>>Subject: [PATCH 1 of 5] Step 1: refactoring
>>
>>Trivial changes to tabs and spaces, formatting etc.
>>
>>diff -r b430bc3cc0f4 -r dc18d71a5304 src/Appender/RollingFileAppender.cs
>>--- a/src/Appender/RollingFileAppender.cs      Tue Jan 22 14:27:20 2013
> +0100
>>+++ b/src/Appender/RollingFileAppender.cs      Tue Jan 22 14:31:05 2013
> +0100
>>@@ -1,10 +1,10 @@
>> #region Apache License
>> //
>>-// Licensed to the Apache Software Foundation (ASF) under one or more
>>+// Licensed to the Apache Software Foundation (ASF) under one or more
>> // contributor license agreements. See the NOTICE file distributed with
>>-// this work for additional information regarding copyright ownership.
>>+// this work for additional information regarding copyright ownership.
>> // The ASF licenses this file to you under the Apache License, Version 2.0
>>-// (the "License"); you may not use this file except in compliance with
>>+// (the "License"); you may not use this file except in compliance with
>> // the License. You may obtain a copy of the License at
>> //
>> // http://www.apache.org/licenses/LICENSE-2.0
>>@@ -31,12 +31,12 @@
>>       // The following sounds good, and I though it was the case, but
> after
>>       // further testing on Windows I have not been able to confirm it.
>>
>>-      /// On the Windows platform if another process has a write lock on
>>the file
>>+      /// On the Windows platform if another process has a write lock on
>>the file
>>       /// that is to be deleted, but allows shared read access to the file
>>then the
>>-      /// file can be moved, but cannot be deleted. If the other process
>>also allows
>>-      /// shared delete access to the file then the file will be deleted
>>once that
>>+      /// file can be moved, but cannot be deleted. If the other process
>>also allows
>>+      /// shared delete access to the file then the file will be deleted
>>once that
>>       /// process closes the file. If it is necessary to open the log file
>>or any
>>-      /// of the backup files outside of this appender for either read or
>>+      /// of the backup files outside of this appender for either read or
>>       /// write access please ensure that read and delete share modes are
>>enabled.
>> #endif
>>
>>@@ -68,34 +68,34 @@
>>       /// <item>Infinite number of backups by file size <see
>>cref="MaxSizeRollBackups"/></item>
>>       /// </list>
>>       /// </para>
>>-      ///
>>+      ///
>>       /// <note>
>>       /// <para>
>>-      /// For large or infinite numbers of backup files a <see
>>cref="CountDirection"/>
>>+      /// For large or infinite numbers of backup files a <see
>>cref="CountDirection"/>
>>       /// greater than zero is highly recommended, otherwise all the
> backup
>>files need
>>       /// to be renamed each time a new backup is created.
>>       /// </para>
>>       /// <para>
>>-      /// When Date/Time based rolling is used setting <see
>>cref="StaticLogFileName"/>
>>+      /// When Date/Time based rolling is used setting <see
>>cref="StaticLogFileName"/>
>>       /// to <see langword="true"/> will reduce the number of file
>>renamings to few or none.
>>       /// </para>
>>       /// </note>
>>-      ///
>>+      ///
>>       /// <note type="caution">
>>       /// <para>
>>       /// Changing <see cref="StaticLogFileName"/> or <see
>>cref="CountDirection"/> without clearing
>>-      /// the log file directory of backup files will cause unexpected and
>>unwanted side effects.
>>+      /// the log file directory of backup files will cause unexpected and
>>unwanted side effects.
>>       /// </para>
>>       /// </note>
>>-      ///
>>+      ///
>>       /// <para>
>>       /// If Date/Time based rolling is enabled this appender will attempt
>>to roll existing files
>>       /// in the directory without a Date/Time tag based on the last write
>>date of the base log file.
>>-      /// The appender only rolls the log file when a message is logged.
> If
>>Date/Time based rolling
>>+      /// The appender only rolls the log file when a message is logged.
> If
>>Date/Time based rolling
>>       /// is enabled then the appender will not roll the log file at the
>>Date/Time boundary but
>>       /// at the point when the next message is logged after the boundary
>>has been crossed.
>>       /// </para>
>>-      ///
>>+      ///
>>       /// <para>
>>       /// The <see cref="RollingFileAppender"/> extends the <see
>>cref="FileAppender"/> and
>>       /// has the same behavior when opening the log file.
>>@@ -110,7 +110,7 @@
>>       /// When rolling a backup file necessitates deleting an older backup
>>file the
>>       /// file to be deleted is moved to a temporary name before being
>>deleted.
>>       /// </para>
>>-      ///
>>+      ///
>>       /// <note type="caution">
>>       /// <para>
>>       /// A maximum number of backup files when rolling on date/time
>>boundaries is not supported.
>>@@ -123,10 +123,10 @@
>>       /// <author>Douglas de la Torre</author>
>>       /// <author>Edward Smit</author>
>>       public class RollingFileAppender : FileAppender
>>-    {
>>-        #region Public Enums
>>+      {
>>+              #region Public Enums
>>
>>-        /// <summary>
>>+              /// <summary>
>>               /// Style of rolling to use
>>               /// </summary>
>>               /// <remarks>
>>@@ -231,7 +231,7 @@
>>               /// Default constructor.
>>               /// </para>
>>               /// </remarks>
>>-              public RollingFileAppender()
>>+              public RollingFileAppender()
>>               {
>>               }
>>
>>@@ -240,9 +240,9 @@
>>               #region Public Instance Properties
>>
>> #if !NET_1_0 && !CLI_1_0 && !NETCF
>>-        /// <summary>
>>+              /// <summary>
>>               /// Gets or sets the strategy for determining the current
> date
>>and time. The default
>>-              /// implementation is to use LocalDateTime which internally
>>calls through to DateTime.Now.
>>+              /// implementation is to use LocalDateTime which internally
>>calls through to DateTime.Now.
>>               /// DateTime.UtcNow may be used on frameworks newer than
> .NET
>>1.0 by specifying
>>               /// <see cref="RollingFileAppender.UniversalDateTime"/>.
>>               /// </summary>
>>@@ -253,19 +253,19 @@
>>               /// <para>
>>               /// Gets or sets the <see
>>cref="RollingFileAppender.IDateTime"/> used to return the current date and
>>time.
>>               /// </para>
>>-        /// <para>
>>-        /// There are two built strategies for determining the current
>>date and time,
>>+              /// <para>
>>+              /// There are two built strategies for determining the
> current
>>date and time,
>>               /// <see cref="RollingFileAppender.LocalDateTime"/>
>>-        /// and <see cref="RollingFileAppender.UniversalDateTime"/>.
>>-        /// </para>
>>-        /// <para>
>>+              /// and <see cref="RollingFileAppender.UniversalDateTime"/>.
>>+              /// </para>
>>+              /// <para>
>>               /// The default strategy is <see
>>cref="RollingFileAppender.LocalDateTime"/>.
>>               /// </para>
>>               /// </remarks>
>> #else
>>-        /// <summary>
>>+              /// <summary>
>>               /// Gets or sets the strategy for determining the current
> date
>>and time. The default
>>-              /// implementation is to use LocalDateTime which internally
>>calls through to DateTime.Now.
>>+              /// implementation is to use LocalDateTime which internally
>>calls through to DateTime.Now.
>>               /// </summary>
>>               /// <value>
>>               /// An implementation of the <see
>>cref="RollingFileAppender.IDateTime"/> interface which returns the current
>>date and time.
>>@@ -274,12 +274,12 @@
>>               /// <para>
>>               /// Gets or sets the <see
>>cref="RollingFileAppender.IDateTime"/> used to return the current date and
>>time.
>>               /// </para>
>>-        /// <para>
>>+              /// <para>
>>               /// The default strategy is <see
>>cref="RollingFileAppender.LocalDateTime"/>.
>>               /// </para>
>>               /// </remarks>
>> #endif
>>-        public IDateTime DateTimeStrategy
>>+              public IDateTime DateTimeStrategy
>>               {
>>                       get { return m_dateTime; }
>>                       set { m_dateTime = value; }
>>@@ -290,12 +290,12 @@
>>               /// when rolling over on date.
>>               /// </summary>
>>               /// <value>
>>-              /// The date pattern to be used for generating file names
> when
>>rolling
>>+              /// The date pattern to be used for generating file names
> when
>>rolling
>>               /// over on date.
>>               /// </value>
>>               /// <remarks>
>>               /// <para>
>>-              /// Takes a string in the same format as expected by
>>+              /// Takes a string in the same format as expected by
>>               /// <see cref="log4net.DateFormatter.SimpleDateFormatter"
> />.
>>               /// </para>
>>               /// <para>
>>@@ -308,7 +308,7 @@
>>                       get { return m_datePattern; }
>>                       set { m_datePattern = value; }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Gets or sets the maximum number of backup files that are
>>kept before
>>               /// the oldest is erased.
>>@@ -319,16 +319,16 @@
>>               /// </value>
>>               /// <remarks>
>>               /// <para>
>>-              /// If set to zero, then there will be no backup files and
> the
>>log file
>>-              /// will be truncated when it reaches <see
>>cref="MaxFileSize"/>.
>>+              /// If set to zero, then there will be no backup files and
> the
>>log file
>>+              /// will be truncated when it reaches <see
>>cref="MaxFileSize"/>.
>>               /// </para>
>>               /// <para>
>>-              /// If a negative number is supplied then no deletions will
> be
>>made.  Note
>>-              /// that this could result in very slow performance as a
> large
>>number of
>>+              /// If a negative number is supplied then no deletions will
> be
>>made.  Note
>>+              /// that this could result in very slow performance as a
> large
>>number of
>>               /// files are rolled over unless <see
> cref="CountDirection"/>
>>is used.
>>               /// </para>
>>               /// <para>
>>-              /// The maximum applies to <b>each</b> time based group of
>>files and
>>+              /// The maximum applies to <b>each</b> time based group of
>>files and
>>               /// <b>not</b> the total.
>>               /// </para>
>>               /// </remarks>
>>@@ -337,20 +337,20 @@
>>                       get { return m_maxSizeRollBackups; }
>>                       set { m_maxSizeRollBackups = value; }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Gets or sets the maximum size that the output file is
>>allowed to reach
>>               /// before being rolled over to backup files.
>>               /// </summary>
>>               /// <value>
>>-              /// The maximum size in bytes that the output file is
> allowed
>>to reach before being
>>+              /// The maximum size in bytes that the output file is
> allowed
>>to reach before being
>>               /// rolled over to backup files.
>>               /// </value>
>>               /// <remarks>
>>               /// <para>
>>               /// This property is equivalent to <see
>>cref="MaximumFileSize"/> except
>>               /// that it is required for differentiating the setter
> taking a
>>-              /// <see cref="long"/> argument from the setter taking a
> <see
>>cref="string"/>
>>+              /// <see cref="long"/> argument from the setter taking a
> <see
>>cref="string"/>
>>               /// argument.
>>               /// </para>
>>               /// <para>
>>@@ -362,20 +362,20 @@
>>                       get { return m_maxFileSize; }
>>                       set { m_maxFileSize = value; }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Gets or sets the maximum size that the output file is
>>allowed to reach
>>               /// before being rolled over to backup files.
>>               /// </summary>
>>               /// <value>
>>-              /// The maximum size that the output file is allowed to
> reach
>>before being
>>+              /// The maximum size that the output file is allowed to
> reach
>>before being
>>               /// rolled over to backup files.
>>               /// </value>
>>               /// <remarks>
>>               /// <para>
>>               /// This property allows you to specify the maximum size
> with
>>the
>>-              /// suffixes "KB", "MB" or "GB" so that the size is
> interpreted
>>being
>>-              /// expressed respectively in kilobytes, megabytes or
>>gigabytes.
>>+              /// suffixes "KB", "MB" or "GB" so that the size is
> interpreted
>>being
>>+              /// expressed respectively in kilobytes, megabytes or
>>gigabytes.
>>               /// </para>
>>               /// <para>
>>               /// For example, the value "10KB" will be interpreted as
> 10240
>>bytes.
>>@@ -396,7 +396,7 @@
>>               }
>>
>>               /// <summary>
>>-              /// Gets or sets the rolling file count direction.
>>+              /// Gets or sets the rolling file count direction.
>>               /// </summary>
>>               /// <value>
>>               /// The rolling file count direction.
>>@@ -413,7 +413,7 @@
>>               /// <para>
>>               /// <see cref="CountDirection" /> &gt;= 0 does the opposite
>>i.e.
>>               /// log.1 is the first backup made, log.5 is the 5th backup
>>made, etc.
>>-              /// For infinite backups use <see cref="CountDirection" />
>>&gt;= 0 to reduce
>>+              /// For infinite backups use <see cref="CountDirection" />
>>&gt;= 0 to reduce
>>               /// rollover costs.
>>               /// </para>
>>               /// <para>The default file count direction is -1.</para>
>>@@ -423,7 +423,7 @@
>>                       get { return m_countDirection; }
>>                       set { m_countDirection = value; }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Gets or sets the rolling style.
>>               /// </summary>
>>@@ -445,7 +445,7 @@
>>                       set
>>                       {
>>                               m_rollingStyle = value;
>>-                              switch (m_rollingStyle)
>>+                              switch (m_rollingStyle)
>>                               {
>>                                       case RollingMode.Once:
>>                                               m_rollDate = false;
>>@@ -467,30 +467,30 @@
>>                                       case RollingMode.Composite:
>>                                               m_rollDate = true;
>>                                               m_rollSize = true;
>>-                                              break;
>>+                                              break;
>>                               }
>>                       }
>>               }
>>
>>-        /// <summary>
>>-        /// Gets or sets a value indicating whether to preserve the file
>>name extension when rolling.
>>-        /// </summary>
>>-        /// <value>
>>-        /// <c>true</c> if the file name extension should be preserved.
>>-        /// </value>
>>-        /// <remarks>
>>-        /// <para>
>>-        /// By default file.log is rolled to file.log.yyyy-MM-dd or
>>file.log.curSizeRollBackup.
>>-        /// However, under Windows the new file name will loose any
>>program associations as the
>>-        /// extension is changed. Optionally file.log can be renamed to
>>file.yyyy-MM-dd.log or
>>-        /// file.curSizeRollBackup.log to maintain any program
>>associations.
>>-        /// </para>
>>-        /// </remarks>
>>-        public bool PreserveLogFileNameExtension
>>-        {
>>-            get { return m_preserveLogFileNameExtension; }
>>-            set { m_preserveLogFileNameExtension = value; }
>>-        }
>>+              /// <summary>
>>+              /// Gets or sets a value indicating whether to preserve the
>>file name extension when rolling.
>>+              /// </summary>
>>+              /// <value>
>>+              /// <c>true</c> if the file name extension should be
> preserved.
>>+              /// </value>
>>+              /// <remarks>
>>+              /// <para>
>>+              /// By default file.log is rolled to file.log.yyyy-MM-dd or
>>file.log.curSizeRollBackup.
>>+              /// However, under Windows the new file name will loose any
>>program associations as the
>>+              /// extension is changed. Optionally file.log can be renamed
> to
>>file.yyyy-MM-dd.log or
>>+              /// file.curSizeRollBackup.log to maintain any program
>>associations.
>>+              /// </para>
>>+              /// </remarks>
>>+              public bool PreserveLogFileNameExtension
>>+              {
>>+                      get { return m_preserveLogFileNameExtension; }
>>+                      set { m_preserveLogFileNameExtension = value; }
>>+              }
>>
>>               /// <summary>
>>               /// Gets or sets a value indicating whether to always log to
>>@@ -507,7 +507,7 @@
>>               /// file.log.yyyy-mm-dd.curSizeRollBackup).
>>               /// </para>
>>               /// <para>
>>-              /// This will make time based rollovers with a large number
> of
>>backups
>>+              /// This will make time based rollovers with a large number
> of
>>backups
>>               /// much faster as the appender it won't have to rename all
> the
>>backups!
>>               /// </para>
>>               /// </remarks>
>>@@ -519,21 +519,21 @@
>>
>>               #endregion Public Instance Properties
>>
>>-          #region Private Static Fields
>>+              #region Private Static Fields
>>
>>-          /// <summary>
>>-          /// The fully qualified type of the RollingFileAppender class.
>>-          /// </summary>
>>-          /// <remarks>
>>-          /// Used by the internal logger to record the Type of the
>>-          /// log message.
>>-          /// </remarks>
>>-          private readonly static Type declaringType =
>>typeof(RollingFileAppender);
>>+              /// <summary>
>>+              /// The fully qualified type of the RollingFileAppender
> class.
>>+              /// </summary>
>>+              /// <remarks>
>>+              /// Used by the internal logger to record the Type of the
>>+              /// log message.
>>+              /// </remarks>
>>+              private readonly static Type declaringType =
>>typeof(RollingFileAppender);
>>
>>-          #endregion Private Static Fields
>>+              #endregion Private Static Fields
>>
>>-              #region Override implementation of FileAppender
>>-
>>+              #region Override implementation of FileAppender
>>+
>>               /// <summary>
>>               /// Sets the quiet writer being used.
>>               /// </summary>
>>@@ -541,7 +541,7 @@
>>               /// This method can be overridden by sub classes.
>>               /// </remarks>
>>               /// <param name="writer">the writer to set</param>
>>-              override protected void SetQWForFiles(TextWriter writer)
>>+              override protected void SetQWForFiles(TextWriter writer)
>>               {
>>                       QuietWriter = new CountingQuietTextWriter(writer,
>>ErrorHandler);
>>               }
>>@@ -557,12 +557,12 @@
>>               /// is need and then appends to the file last.
>>               /// </para>
>>               /// </remarks>
>>-              override protected void Append(LoggingEvent loggingEvent)
>>+              override protected void Append(LoggingEvent loggingEvent)
>>               {
>>                       AdjustFileBeforeAppend();
>>                       base.Append(loggingEvent);
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Write out an array of logging events.
>>               /// </summary>
>>@@ -574,7 +574,7 @@
>>               /// is need and then appends to the file last.
>>               /// </para>
>>               /// </remarks>
>>-              override protected void Append(LoggingEvent[] loggingEvents)
>>+              override protected void Append(LoggingEvent[] loggingEvents)
>>               {
>>                       AdjustFileBeforeAppend();
>>                       base.Append(loggingEvents);
>>@@ -592,21 +592,21 @@
>>               /// </remarks>
>>               virtual protected void AdjustFileBeforeAppend()
>>               {
>>-                      if (m_rollDate)
>>+                      if (m_rollDate)
>>                       {
>>                               DateTime n = m_dateTime.Now;
>>-                              if (n >= m_nextCheck)
>>+                              if (n >= m_nextCheck)
>>                               {
>>                                       m_now = n;
>>                                       m_nextCheck = NextCheckDate(m_now,
>>m_rollPoint);
>>-
>>+
>>                                       RollOverTime(true);
>>                               }
>>                       }
>>-
>>-                      if (m_rollSize)
>>+
>>+                      if (m_rollSize)
>>                       {
>>-                              if ((File != null) &&
>>((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
>>+                              if ((File != null) &&
>>((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
>>                               {
>>                                       RollOverSize();
>>                               }
>>@@ -631,7 +631,7 @@
>>
>>                               // Calculate the current size of the file
>>                               long currentCount = 0;
>>-                              if (append)
>>+                              if (append)
>>                               {
>>
> using(SecurityContext.Impersonate(this))
>>                                       {
>>@@ -656,7 +656,7 @@
>>                                       }
>>                               }
>>
>>-                              if (!m_staticLogFileName)
>>+                              if (!m_staticLogFileName)
>>                               {
>>                                       m_scheduledFilename = fileName;
>>                               }
>>@@ -676,25 +676,25 @@
>>               /// <returns>the output file name</returns>
>>               /// <remarks>
>>               /// The output file name is based on the base fileName
>>specified.
>>-              /// If <see cref="StaticLogFileName"/> is set then the
> output
>>+              /// If <see cref="StaticLogFileName"/> is set then the
> output
>>               /// file name is the same as the base file passed in.
> Otherwise
>>               /// the output file depends on the date pattern, on the
> count
>>               /// direction or both.
>>               /// </remarks>
>>               protected string GetNextOutputFileName(string fileName)
>>               {
>>-                      if (!m_staticLogFileName)
>>+                      if (!m_staticLogFileName)
>>                       {
>>                               fileName = fileName.Trim();
>>
>>                               if (m_rollDate)
>>                               {
>>-                    fileName = CombinePath(fileName,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>+                                      fileName = CombinePath(fileName,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>                               }
>>
>>-                              if (m_countDirection >= 0)
>>+                              if (m_countDirection >= 0)
>>                               {
>>-                    fileName = CombinePath(fileName, "." +
>>m_curSizeRollBackups);
>>+                                      fileName = CombinePath(fileName, "."
> +
>>m_curSizeRollBackups);
>>                               }
>>                       }
>>
>>@@ -711,7 +711,7 @@
>>               private void DetermineCurSizeRollBackups()
>>               {
>>                       m_curSizeRollBackups = 0;
>>-
>>+
>>                       string fullPath = null;
>>                       string fileName = null;
>>
>>@@ -735,14 +735,14 @@
>>               /// <returns></returns>
>>               private string GetWildcardPatternForFile(string
> baseFileName)
>>               {
>>-            if (m_preserveLogFileNameExtension)
>>-            {
>>-                return Path.GetFileNameWithoutExtension(baseFileName) +
>>".*" + Path.GetExtension(baseFileName);
>>-            }
>>-            else
>>-            {
>>-                return baseFileName + '*';
>>-            }
>>+                      if (m_preserveLogFileNameExtension)
>>+                      {
>>+                              return
>>Path.GetFileNameWithoutExtension(baseFileName) + ".*" +
>>Path.GetExtension(baseFileName);
>>+                      }
>>+                      else
>>+                      {
>>+                              return baseFileName + '*';
>>+                      }
>>               }
>>
>>               /// <summary>
>>@@ -767,10 +767,10 @@
>>                                       string baseFileName =
>>Path.GetFileName(fullPath);
>>
>>                                       string[] files =
>>Directory.GetFiles(directory, GetWildcardPatternForFile(baseFileName));
>>-
>>+
>>                                       if (files != null)
>>                                       {
>>-                                              for (int i = 0; i <
> files.Length; i++)
>>+                                              for (int i = 0; i <
> files.Length; i++)
>>                                               {
>>                                                       string curFileName =
>>Path.GetFileName(files[i]);
>>                                                       if
>>(curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFileName)))
>>@@ -790,14 +790,15 @@
>>               /// </summary>
>>               private void RollOverIfDateBoundaryCrossing()
>>               {
>>-                      if (m_staticLogFileName && m_rollDate)
>>+                      if (m_staticLogFileName && m_rollDate)
>>                       {
>>-                              if (FileExists(m_baseFileName))
>>+                              if (FileExists(m_baseFileName))
>>                               {
>>                                       DateTime last;
>>-
> using(SecurityContext.Impersonate(this)) {
>>+
> using(SecurityContext.Impersonate(this))
>>+                                      {
>> #if !NET_1_0 && !CLI_1_0 && !NETCF
>>-                        if (DateTimeStrategy is UniversalDateTime)
>>+                                              if (DateTimeStrategy is
>>UniversalDateTime)
>>                                               {
>>                                                       last =
>>System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
>>                                               }
>>@@ -806,12 +807,12 @@
>> #endif
>>                                                       last =
>>System.IO.File.GetLastWriteTime(m_baseFileName);
>> #if !NET_1_0 && !CLI_1_0 && !NETCF
>>-                        }
>>+                                              }
>> #endif
>>-                    }
>>+                                      }
>>                                       LogLog.Debug(declaringType,
>>"["+last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inv
>>ariantInfo)+"] vs.
>>["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inv
>>ariantInfo)+"]");
>>
>>-                                      if
>>(!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inva
>>riantInfo).Equals(m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo))))
>>+                                      if
>>(!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inva
>>riantInfo).Equals(m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo))))
>>                                       {
>>                                               m_scheduledFilename =
> m_baseFileName +
>>last.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>>                                               LogLog.Debug(declaringType,
> "Initial
>>roll over to ["+m_scheduledFilename+"]");
>>@@ -835,7 +836,7 @@
>>               ///     </list>
>>               ///     </para>
>>               /// </remarks>
>>-              protected void ExistingInit()
>>+              protected void ExistingInit()
>>               {
>>                       DetermineCurSizeRollBackups();
>>                       RollOverIfDateBoundaryCrossing();
>>@@ -878,29 +879,29 @@
>>               /// <param name="curFileName"></param>
>>               private void InitializeFromOneFile(string baseFile, string
>>curFileName)
>>               {
>>-            if
>>(curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)) ==
>>false)
>>+                      if (!
>>curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)))
>>                       {
>>                               // This is not a log file, so ignore
>>                               return;
>>                       }
>>-                      if (curFileName.Equals(baseFile))
>>+                      if (curFileName.Equals(baseFile))
>>                       {
>>                               // Base log file is not an incremented
> logfile (.1
>>or .2, etc)
>>                               return;
>>                       }
>>-
>>-            /*
>>-                      if (m_staticLogFileName)
>>+
>>+                      /*
>>+                      if (m_staticLogFileName)
>>                       {
>>                               int endLength = curFileName.Length - index;
>>-                              if (baseFile.Length + endLength !=
>>curFileName.Length)
>>+                              if (baseFile.Length + endLength !=
>>curFileName.Length)
>>                               {
>>                                       // file is probably
> scheduledFilename + .x so
>>I don't care
>>                                       return;
>>                               }
>>                       }
>>-            */
>>-
>>+                      */
>>+
>>                       // Only look for files in the current roll point
>>                       if (m_rollDate && !m_staticLogFileName)
>>                       {
>>@@ -910,48 +911,48 @@
>>                                       return;
>>                               }
>>                       }
>>-
>>-                      try
>>+
>>+                      try
>>                       {
>>                               // Bump the counter up to the highest count
> seen so
>>far
>>-                int backup = GetBackUpIndex(curFileName);
>>-
>>-                // caution: we might get a false positive when certain
>>-                // date patterns such as yyyyMMdd are used...those are
>>-                // valid number but aren't the kind of back up index
>>-                // we're looking for
>>-                if (backup > m_curSizeRollBackups)
>>-                {
>>-                    if (0 == m_maxSizeRollBackups)
>>-                    {
>>-                        // Stay at zero when zero backups are desired
>>-                    }
>>-                    else if (-1 == m_maxSizeRollBackups)
>>-                    {
>>-                        // Infinite backups, so go as high as the highest
>>value
>>-                        m_curSizeRollBackups = backup;
>>-                    }
>>-                    else
>>-                    {
>>-                        // Backups limited to a finite number
>>-                        if (m_countDirection >= 0)
>>-                        {
>>-                            // Go with the highest file when counting up
>>-                            m_curSizeRollBackups = backup;
>>-                        }
>>-                        else
>>-                        {
>>-                            // Clip to the limit when counting down
>>-                            if (backup <= m_maxSizeRollBackups)
>>-                            {
>>-                                m_curSizeRollBackups = backup;
>>-                            }
>>-                        }
>>-                    }
>>-                    LogLog.Debug(declaringType, "File name [" +
>>curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
>>-                }
>>-                      }
>>-                      catch(FormatException)
>>+                              int backup = GetBackUpIndex(curFileName);
>>+
>>+                              // caution: we might get a false positive
> when
>>certain
>>+                              // date patterns such as yyyyMMdd are
> used...those
>>are
>>+                              // valid number but aren't the kind of back
> up
>>index
>>+                              // we're looking for
>>+                              if (backup > m_curSizeRollBackups)
>>+                              {
>>+                                      if (0 == m_maxSizeRollBackups)
>>+                                      {
>>+                                              // Stay at zero when zero
> backups are
>>desired
>>+                                      }
>>+                                      else if (-1 == m_maxSizeRollBackups)
>>+                                      {
>>+                                              // Infinite backups, so go
> as high as
>>the highest value
>>+                                              m_curSizeRollBackups =
> backup;
>>+                                      }
>>+                                      else
>>+                                      {
>>+                                              // Backups limited to a
> finite number
>>+                                              if (m_countDirection >= 0)
>>+                                              {
>>+                                                      // Go with the
> highest file when
>>counting up
>>+                                                      m_curSizeRollBackups
> = backup;
>>+                                              }
>>+                                              else
>>+                                              {
>>+                                                      // Clip to the limit
> when
>>counting down
>>+                                                      if (backup <=
>>m_maxSizeRollBackups)
>>+                                                      {
>>+
> m_curSizeRollBackups =
>>backup;
>>+                                                      }
>>+                                              }
>>+                                      }
>>+                                      LogLog.Debug(declaringType, "File
> name [" +
>>curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
>>+                              }
>>+                      }
>>+                      catch(FormatException)
>>                       {
>>                               //this happens when file.log ->
> file.log.yyyy-MM-dd
>>which is normal
>>                               //when staticLogFileName == false
>>@@ -959,38 +960,38 @@
>>                       }
>>               }
>>
>>-        /// <summary>
>>-        /// Attempts to extract a number from the end of the file name
>>that indicates
>>-        /// the number of the times the file has been rolled over.
>>-        /// </summary>
>>-        /// <remarks>
>>-        /// Certain date pattern extensions like yyyyMMdd will be parsed
>>as valid backup indexes.
>>-        /// </remarks>
>>-        /// <param name="curFileName"></param>
>>-        /// <returns></returns>
>>-          private int GetBackUpIndex(string curFileName)
>>-          {
>>-            int backUpIndex = -1;
>>-            string fileName = curFileName;
>>+              /// <summary>
>>+              /// Attempts to extract a number from the end of the file
> name
>>that indicates
>>+              /// the number of the times the file has been rolled over.
>>+              /// </summary>
>>+              /// <remarks>
>>+              /// Certain date pattern extensions like yyyyMMdd will be
>>parsed as valid backup indexes.
>>+              /// </remarks>
>>+              /// <param name="curFileName"></param>
>>+              /// <returns></returns>
>>+              private int GetBackUpIndex(string curFileName)
>>+              {
>>+                      int backUpIndex = -1;
>>+                      string fileName = curFileName;
>>
>>-            if (m_preserveLogFileNameExtension)
>>-            {
>>-                fileName = Path.GetFileNameWithoutExtension(fileName);
>>-            }
>>-
>>-            int index = fileName.LastIndexOf(".");
>>-            if (index > 0)
>>-            {
>>-                // 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
>>-                SystemInfo.TryParse(fileName.Substring(index + 1), out
>>backUpIndex);
>>-            }
>>+                      if (m_preserveLogFileNameExtension)
>>+                      {
>>+                              fileName =
>>Path.GetFileNameWithoutExtension(fileName);
>>+                      }
>>
>>-            return backUpIndex;
>>-          }
>>+                      int index = fileName.LastIndexOf(".");
>>+                      if (index > 0)
>>+                      {
>>+                              // 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
>>+                              SystemInfo.TryParse(fileName.Substring(index
> + 1),
>>out backUpIndex);
>>+                      }
>>
>>-          /// <summary>
>>-              /// Takes a list of files and a base file name, and looks
> for
>>+                      return backUpIndex;
>>+              }
>>+
>>+              /// <summary>
>>+              /// Takes a list of files and a base file name, and looks
> for
>>               /// 'incremented' versions of the base file.  Bumps the max
>>               /// count up to the highest count seen.
>>               /// </summary>
>>@@ -1018,13 +1019,13 @@
>>               /// Essentially the date pattern is examined to determine
> what
>>the
>>               /// most suitable roll point is. The roll point chosen is
> the
>>roll point
>>               /// with the smallest period that can be detected using the
>>date pattern
>>-              /// supplied. i.e. if the date pattern only outputs the
> year,
>>month, day
>>+              /// supplied. i.e. if the date pattern only outputs the
> year,
>>month, day
>>               /// and hour then the smallest roll point that can be
> detected
>>would be
>>               /// and hourly roll point as minutes could not be detected.
>>               /// </remarks>
>>-              private RollPoint ComputeCheckPeriod(string datePattern)
>>+              private RollPoint ComputeCheckPeriod(string datePattern)
>>               {
>>-                      // s_date1970 is 1970-01-01 00:00:00 this is
>>UniversalSortableDateTimePattern
>>+                      // s_date1970 is 1970-01-01 00:00:00 this is
>>UniversalSortableDateTimePattern
>>                       // (based on ISO 8601) using universal time. This
> date is
>>used for reference
>>                       // purposes to calculate the resolution of the date
>>pattern.
>>
>>@@ -1032,7 +1033,7 @@
>>                       string r0 = s_date1970.ToString(datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>>
>>                       // Check each type of rolling mode starting with the
>>smallest increment.
>>-                      for(int i = (int)RollPoint.TopOfMinute; i <=
>>(int)RollPoint.TopOfMonth; i++)
>>+                      for(int i = (int)RollPoint.TopOfMinute; i <=
>>(int)RollPoint.TopOfMonth; i++)
>>                       {
>>                               // Get string representation of next pattern
>>                               string r1 = NextCheckDate(s_date1970,
>>(RollPoint)i).ToString(datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>>@@ -1040,7 +1041,7 @@
>>                               LogLog.Debug(declaringType, "Type = ["+i+"],
> r0 =
>>["+r0+"], r1 = ["+r1+"]");
>>
>>                               // Check if the string representations are
>>different
>>-                              if (r0 != null && r1 != null &&
> !r0.Equals(r1))
>>+                              if (r0 != null && r1 != null &&
> !r0.Equals(r1))
>>                               {
>>                                       // Found highest precision roll
> point
>>                                       return (RollPoint)i;
>>@@ -1056,13 +1057,13 @@
>>               /// <remarks>
>>               /// <para>
>>               /// This is part of the <see cref="IOptionHandler"/> delayed
>>object
>>-              /// activation scheme. The <see cref="ActivateOptions"/>
> method
>>must
>>+              /// activation scheme. The <see cref="ActivateOptions"/>
> method
>>must
>>               /// be called on this object after the configuration
> properties
>>have
>>               /// been set. Until <see cref="ActivateOptions"/> is called
>>this
>>-              /// object is in an undefined state and must not be used.
>>+              /// object is in an undefined state and must not be used.
>>               /// </para>
>>               /// <para>
>>-              /// If any of the configuration properties are modified then
>>+              /// If any of the configuration properties are modified then
>>               /// <see cref="ActivateOptions"/> must be called again.
>>               /// </para>
>>               /// <para>
>>@@ -1071,14 +1072,14 @@
>>               /// the current number of backups.
>>               /// </para>
>>               /// </remarks>
>>-              override public void ActivateOptions()
>>+              override public void ActivateOptions()
>>               {
>>                       if (m_dateTime == null)
>>                       {
>>                               m_dateTime = new LocalDateTime();
>>                       }
>>
>>-                      if (m_rollDate && m_datePattern != null)
>>+                      if (m_rollDate && m_datePattern != null)
>>                       {
>>                               m_now = m_dateTime.Now;
>>                               m_rollPoint =
> ComputeCheckPeriod(m_datePattern);
>>@@ -1090,8 +1091,8 @@
>>
>>                               // next line added as this removes the name
> check
>>in rollOver
>>                               m_nextCheck = NextCheckDate(m_now,
> m_rollPoint);
>>-                      }
>>-                      else
>>+                      }
>>+                      else
>>                       {
>>                               if (m_rollDate)
>>                               {
>>@@ -1117,36 +1118,36 @@
>>
>>                       if (m_rollDate && File != null &&
> m_scheduledFilename ==
>>null)
>>                       {
>>-                m_scheduledFilename = CombinePath(File,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>+                              m_scheduledFilename = CombinePath(File,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>                       }
>>
>>                       ExistingInit();
>>-
>>+
>>                       base.ActivateOptions();
>>               }
>>
>>               #endregion
>>-
>>+
>>               #region Roll File
>>
>>-        /// <summary>
>>-        ///
>>-        /// </summary>
>>-        /// <param name="path1"></param>
>>-        /// <param name="path2">.1, .2, .3, etc.</param>
>>-        /// <returns></returns>
>>-        private string CombinePath(string path1, string path2)
>>-        {
>>-            string extension = Path.GetExtension(path1);
>>-            if (m_preserveLogFileNameExtension && extension.Length > 0)
>>-            {
>>-                return Path.Combine(Path.GetDirectoryName(path1),
>>Path.GetFileNameWithoutExtension(path1) + path2 + extension);
>>-            }
>>-            else
>>-            {
>>-                return path1 + path2;
>>-            }
>>-        }
>>+              /// <summary>
>>+              ///
>>+              /// </summary>
>>+              /// <param name="path1"></param>
>>+              /// <param name="path2">.1, .2, .3, etc.</param>
>>+              /// <returns></returns>
>>+              private string CombinePath(string path1, string path2)
>>+              {
>>+                      string extension = Path.GetExtension(path1);
>>+                      if (m_preserveLogFileNameExtension &&
> extension.Length >
>>0)
>>+                      {
>>+                              return
> Path.Combine(Path.GetDirectoryName(path1),
>>Path.GetFileNameWithoutExtension(path1) + path2 + extension);
>>+                      }
>>+                      else
>>+                      {
>>+                              return path1 + path2;
>>+                      }
>>+              }
>>
>>               /// <summary>
>>               /// Rollover the file(s) to date/time tagged file(s).
>>@@ -1155,53 +1156,53 @@
>>               /// <remarks>
>>               /// <para>
>>               /// Rollover the file(s) to date/time tagged file(s).
>>-              /// Resets curSizeRollBackups.
>>+              /// Resets curSizeRollBackups.
>>               /// If fileIsOpen is set then the new file is opened
> (through
>>SafeOpenFile).
>>               /// </para>
>>               /// </remarks>
>>-              protected void RollOverTime(bool fileIsOpen)
>>+              protected void RollOverTime(bool fileIsOpen)
>>               {
>>-                      if (m_staticLogFileName)
>>+                      if (m_staticLogFileName)
>>                       {
>>                               // Compute filename, but only if datePattern
> is
>>specified
>>-                              if (m_datePattern == null)
>>+                              if (m_datePattern == null)
>>                               {
>>                                       ErrorHandler.Error("Missing
> DatePattern
>>option in rollOver().");
>>                                       return;
>>                               }
>>-
>>+
>>                               //is the new file name equivalent to the
> 'current'
>>one
>>                               //something has gone wrong if we hit this --
> we
>>should only
>>                               //roll over if the new file will be
> different from
>>the old
>>                               string dateFormat =
> m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>>-                if (m_scheduledFilename.Equals(CombinePath(File,
>>dateFormat)))
>>+                              if
> (m_scheduledFilename.Equals(CombinePath(File,
>>dateFormat)))
>>                               {
>>-                    ErrorHandler.Error("Compare " + m_scheduledFilename +
>>" : " + CombinePath(File, dateFormat));
>>+                                      ErrorHandler.Error("Compare " +
>>m_scheduledFilename + " : " + CombinePath(File, dateFormat));
>>                                       return;
>>                               }
>>-
>>+
>>                               if (fileIsOpen)
>>                               {
>>                                       // close current file, and rename it
> to
>>datedFilename
>>                                       this.CloseFile();
>>                               }
>>-
>>+
>>                               //we may have to roll over a large number of
>>backups here
>>-                              for (int i = 1; i <= m_curSizeRollBackups;
> i++)
>>+                              for (int i = 1; i <= m_curSizeRollBackups;
> i++)
>>                               {
>>-                    string from = CombinePath(File, "." + i);
>>-                    string to = CombinePath(m_scheduledFilename, "." + i);
>>+                                      string from = CombinePath(File, "."
> + i);
>>+                                      string to =
> CombinePath(m_scheduledFilename,
>>"." + i);
>>                                       RollFile(from, to);
>>                               }
>>-
>>+
>>                               RollFile(File, m_scheduledFilename);
>>                       }
>>-
>>+
>>                       //We've cleared out the old date and are ready for
> the
>>new
>>-                      m_curSizeRollBackups = 0;
>>-
>>+                      m_curSizeRollBackups = 0;
>>+
>>                       //new scheduled name
>>-            m_scheduledFilename = CombinePath(File,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>+                      m_scheduledFilename = CombinePath(File,
>>m_now.ToString(m_datePattern,
>>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>>
>>                       if (fileIsOpen)
>>                       {
>>@@ -1209,7 +1210,7 @@
>>                               SafeOpenFile(m_baseFileName, false);
>>                       }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Renames file <paramref name="fromFile"/> to file
> <paramref
>>name="toFile"/>.
>>               /// </summary>
>>@@ -1221,7 +1222,7 @@
>>               /// also checks for existence of target file and deletes if
> it
>>does.
>>               /// </para>
>>               /// </remarks>
>>-              protected void RollFile(string fromFile, string toFile)
>>+              protected void RollFile(string fromFile, string toFile)
>>               {
>>                       if (FileExists(fromFile))
>>                       {
>>@@ -1265,7 +1266,7 @@
>>                               return System.IO.File.Exists(path);
>>                       }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Deletes the specified file if it exists.
>>               /// </summary>
>>@@ -1278,9 +1279,9 @@
>>               /// be deleted, but it still can be moved.
>>               /// </para>
>>               /// </remarks>
>>-              protected void DeleteFile(string fileName)
>>+              protected void DeleteFile(string fileName)
>>               {
>>-                      if (FileExists(fileName))
>>+                      if (FileExists(fileName))
>>                       {
>>                               // We may not have permission to delete the
> file,
>>or the file may be locked
>>
>>@@ -1327,7 +1328,7 @@
>>                               }
>>                       }
>>               }
>>-
>>+
>>               /// <summary>
>>               /// Implements file roll base on file size.
>>               /// </summary>
>>@@ -1354,18 +1355,18 @@
>>               /// renamed if needed and no files are deleted.
>>               /// </para>
>>               /// </remarks>
>>-              protected void RollOverSize()
>>+              protected void RollOverSize()
>>               {
>>                       this.CloseFile(); // keep windows happy.
>>-
>>+
>>                       LogLog.Debug(declaringType, "rolling over count
>>["+((CountingQuietTextWriter)QuietWriter).Count+"]");
>>                       LogLog.Debug(declaringType, "maxSizeRollBackups
>>["+m_maxSizeRollBackups+"]");
>>                       LogLog.Debug(declaringType, "curSizeRollBackups
>>["+m_curSizeRollBackups+"]");
>>                       LogLog.Debug(declaringType, "countDirection
>>["+m_countDirection+"]");
>>
>>                       RollOverRenameFiles(File);
>>-
>>-                      if (!m_staticLogFileName && m_countDirection >= 0)
>>+
>>+                      if (!m_staticLogFileName && m_countDirection >= 0)
>>                       {
>>                               m_curSizeRollBackups++;
>>                       }
>>@@ -1386,7 +1387,7 @@
>>               /// If <c>countDirection</c> &lt; 0, then files
>>               /// {<c>File.1</c>, ..., <c>File.curSizeRollBackups -1</c>}
>>               /// are renamed to {<c>File.2</c>, ...,
>>-              /// <c>File.curSizeRollBackups</c>}.
>>+              /// <c>File.curSizeRollBackups</c>}.
>>               /// </para>
>>               /// <para>
>>               /// If <c>maxSizeRollBackups</c> is equal to zero, then the
>>@@ -1400,35 +1401,35 @@
>>               /// This is called by <see cref="RollOverSize"/> to rename
> the
>>files.
>>               /// </para>
>>               /// </remarks>
>>-              protected void RollOverRenameFiles(string baseFileName)
>>+              protected void RollOverRenameFiles(string baseFileName)
>>               {
>>                       // If maxBackups <= 0, then there is no file
> renaming to
>>be done.
>>-                      if (m_maxSizeRollBackups != 0)
>>+                      if (m_maxSizeRollBackups != 0)
>>                       {
>>-                              if (m_countDirection < 0)
>>+                              if (m_countDirection < 0)
>>                               {
>>                                       // Delete the oldest file, to keep
> Windows
>>happy.
>>-                                      if (m_curSizeRollBackups ==
>>m_maxSizeRollBackups)
>>+                                      if (m_curSizeRollBackups ==
>>m_maxSizeRollBackups)
>>                                       {
>>-                        DeleteFile(CombinePath(baseFileName, "." +
>>m_maxSizeRollBackups));
>>+
> DeleteFile(CombinePath(baseFileName,
>>"." + m_maxSizeRollBackups));
>>                                               m_curSizeRollBackups--;
>>                                       }
>>-
>>+
>>                                       // Map {(maxBackupIndex - 1), ...,
> 2, 1} to
>>{maxBackupIndex, ..., 3, 2}
>>-                                      for (int i = m_curSizeRollBackups; i
>>= 1; i-
>>-)
>>+                                      for (int i = m_curSizeRollBackups; i
>>= 1; i-
>>-)
>>                                       {
>>-                        RollFile((CombinePath(baseFileName, "." + i)),
>>(CombinePath(baseFileName, "." + (i + 1))));
>>+
> RollFile((CombinePath(baseFileName, "."
>>+ i)), (CombinePath(baseFileName, "." + (i + 1))));
>>                                       }
>>-
>>+
>>                                       m_curSizeRollBackups++;
>>
>>                                       // Rename fileName to fileName.1
>>-                    RollFile(baseFileName, CombinePath(baseFileName,
>>".1"));
>>-                              }
>>-                              else
>>+                                      RollFile(baseFileName,
>>CombinePath(baseFileName, ".1"));
>>+                              }
>>+                              else
>>                               {
>>                                       //countDirection >= 0
>>-                                      if (m_curSizeRollBackups >=
>>m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
>>+                                      if (m_curSizeRollBackups >=
>>m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
>>                                       {
>>                                               //delete the first and keep
> counting
>>up.
>>                                               int oldestFileIndex =
>>m_curSizeRollBackups - m_maxSizeRollBackups;
>>@@ -1446,20 +1447,20 @@
>>                                               if (!m_staticLogFileName)
>>                                               {
>>                                                       int lastDotIndex =
>>archiveFileBaseName.LastIndexOf(".");
>>-                                                      if (lastDotIndex >=
> 0)
>>+                                                      if (lastDotIndex >=
> 0)
>>                                                       {
>>
> archiveFileBaseName =
>>archiveFileBaseName.Substring(0, lastDotIndex);
>>                                                       }
>>                                               }
>>
>>                                               // Delete the archive file
>>-                        DeleteFile(CombinePath(archiveFileBaseName, "." +
>>oldestFileIndex));
>>+
>>       DeleteFile(CombinePath(archiveFileBaseName, "." + oldestFileIndex));
>>                                       }
>>-
>>-                                      if (m_staticLogFileName)
>>+
>>+                                      if (m_staticLogFileName)
>>                                       {
>>                                               m_curSizeRollBackups++;
>>-                        RollFile(baseFileName, CombinePath(baseFileName,
>>"." + m_curSizeRollBackups));
>>+                                              RollFile(baseFileName,
>>CombinePath(baseFileName, "." + m_curSizeRollBackups));
>>                                       }
>>                               }
>>                       }
>>@@ -1486,13 +1487,13 @@
>>               /// worth of time and get the start time of the next window
> for
>>the rollpoint.
>>               /// </para>
>>               /// </remarks>
>>-              protected DateTime NextCheckDate(DateTime currentDateTime,
>>RollPoint rollPoint)
>>+              protected DateTime NextCheckDate(DateTime currentDateTime,
>>RollPoint rollPoint)
>>               {
>>                       // Local variable to work on (this does not look
> very
>>efficient)
>>                       DateTime current = currentDateTime;
>>
>>                       // Do slightly different things depending on what
> the
>>type of roll point we want.
>>-                      switch(rollPoint)
>>+                      switch(rollPoint)
>>                       {
>>                               case RollPoint.TopOfMinute:
>>                                       current = current.AddMilliseconds(-
>>current.Millisecond);
>>@@ -1512,11 +1513,11 @@
>>                                       current = current.AddSeconds(-
>>current.Second);
>>                                       current = current.AddMinutes(-
>>current.Minute);
>>
>>-                                      if (current.Hour < 12)
>>+                                      if (current.Hour < 12)
>>                                       {
>>                                               current =
> current.AddHours(12 -
>>current.Hour);
>>-                                      }
>>-                                      else
>>+                                      }
>>+                                      else
>>                                       {
>>                                               current = current.AddHours(-
>>current.Hour);
>>                                               current =
> current.AddDays(1);
>>@@ -1547,7 +1548,7 @@
>>                                       current = current.AddDays(1 -
> current.Day);
>>/* first day of month is 1 not 0 */
>>                                       current = current.AddMonths(1);
>>                                       break;
>>-                      }
>>+                      }
>>                       return current;
>>               }
>>
>>@@ -1563,38 +1564,38 @@
>>               private IDateTime m_dateTime = null;
>>
>>               /// <summary>
>>-              /// The date pattern. By default, the pattern is set to
>><c>".yyyy-MM-dd"</c>
>>+              /// The date pattern. By default, the pattern is set to
>><c>".yyyy-MM-dd"</c>
>>               /// meaning daily rollover.
>>               /// </summary>
>>               private string m_datePattern = ".yyyy-MM-dd";
>>-
>>+
>>               /// <summary>
>>               /// The actual formatted filename that is currently being
>>written to
>>               /// or will be the file transferred to on roll over
>>               /// (based on staticLogFileName).
>>               /// </summary>
>>               private string m_scheduledFilename = null;
>>-
>>+
>>               /// <summary>
>>               /// The timestamp when we shall next recompute the filename.
>>               /// </summary>
>>               private DateTime m_nextCheck = DateTime.MaxValue;
>>-
>>+
>>               /// <summary>
>>               /// Holds date of last roll over
>>               /// </summary>
>>               private DateTime m_now;
>>-
>>+
>>               /// <summary>
>>               /// The type of rolling done
>>               /// </summary>
>>               private RollPoint m_rollPoint;
>>-
>>+
>>               /// <summary>
>>               /// The default maximum file size is 10MB
>>               /// </summary>
>>               private long m_maxFileSize = 10*1024*1024;
>>-
>>+
>>               /// <summary>
>>               /// There is zero backup files by default
>>               /// </summary>
>>@@ -1604,12 +1605,12 @@
>>               /// How many sized based backups have been made so far
>>               /// </summary>
>>               private int m_curSizeRollBackups = 0;
>>-
>>+
>>               /// <summary>
>>-              /// The rolling file count direction.
>>+              /// The rolling file count direction.
>>               /// </summary>
>>               private int m_countDirection = -1;
>>-
>>+
>>               /// <summary>
>>               /// The rolling mode used in this appender.
>>               /// </summary>
>>@@ -1624,13 +1625,13 @@
>>               /// Cache flag set if we are rolling by size.
>>               /// </summary>
>>               private bool m_rollSize = true;
>>-
>>+
>>               /// <summary>
>>               /// Value indicating whether to always log to the same file.
>>               /// </summary>
>>               private bool m_staticLogFileName = true;
>>-
>>-              /// <summary>
>>+
>>+              /// <summary>
>>               /// Value indicating whether to preserve the file name
>>extension when rolling.
>>               /// </summary>
>>               private bool m_preserveLogFileNameExtension = false;
>>@@ -1640,7 +1641,7 @@
>>               /// FileName provided in configuration.  Used for rolling
>>properly
>>               /// </summary>
>>               private string m_baseFileName;
>>-
>>+
>>               #endregion Private Instance Fields
>>
>>               #region Static Members
>>@@ -1697,7 +1698,7 @@
>>               }
>>
>> #if !NET_1_0 && !CLI_1_0 && !NETCF
>>-        /// <summary>
>>+              /// <summary>
>>               /// Implementation of <see cref="IDateTime"/> that returns
> the
>>current time as the coordinated universal time (UTC).
>>               /// </summary>
>>               private class UniversalDateTime : IDateTime
>>@@ -1718,6 +1719,6 @@
>>               }
>> #endif
>>
>>-        #endregion DateTime
>>+              #endregion DateTime
>>       }
>> }
>



--
http://www.grobmeier.de
https://www.timeandbill.de

RE: [PATCH 1 of 5] Step 1: refactoring

Posted by Dominik Psenner <dp...@gmail.com>.
Quite a large patch, but looks sensible.

>-----Original Message-----
>From: Dominik Psenner [mailto:dpsenner@gmail.com]
>Sent: Tuesday, January 22, 2013 2:41 PM
>To: log4net-dev@logging.apache.org
>Subject: [PATCH 1 of 5] Step 1: refactoring
>
>Trivial changes to tabs and spaces, formatting etc.
>
>diff -r b430bc3cc0f4 -r dc18d71a5304 src/Appender/RollingFileAppender.cs
>--- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:27:20 2013
+0100
>+++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:05 2013
+0100
>@@ -1,10 +1,10 @@
> #region Apache License
> //
>-// Licensed to the Apache Software Foundation (ASF) under one or more
>+// Licensed to the Apache Software Foundation (ASF) under one or more
> // contributor license agreements. See the NOTICE file distributed with
>-// this work for additional information regarding copyright ownership.
>+// this work for additional information regarding copyright ownership.
> // The ASF licenses this file to you under the Apache License, Version 2.0
>-// (the "License"); you may not use this file except in compliance with
>+// (the "License"); you may not use this file except in compliance with
> // the License. You may obtain a copy of the License at
> //
> // http://www.apache.org/licenses/LICENSE-2.0
>@@ -31,12 +31,12 @@
> 	// The following sounds good, and I though it was the case, but
after
> 	// further testing on Windows I have not been able to confirm it.
>
>-	/// On the Windows platform if another process has a write lock on
>the file
>+	/// On the Windows platform if another process has a write lock on
>the file
> 	/// that is to be deleted, but allows shared read access to the file
>then the
>-	/// file can be moved, but cannot be deleted. If the other process
>also allows
>-	/// shared delete access to the file then the file will be deleted
>once that
>+	/// file can be moved, but cannot be deleted. If the other process
>also allows
>+	/// shared delete access to the file then the file will be deleted
>once that
> 	/// process closes the file. If it is necessary to open the log file
>or any
>-	/// of the backup files outside of this appender for either read or
>+	/// of the backup files outside of this appender for either read or
> 	/// write access please ensure that read and delete share modes are
>enabled.
> #endif
>
>@@ -68,34 +68,34 @@
> 	/// <item>Infinite number of backups by file size <see
>cref="MaxSizeRollBackups"/></item>
> 	/// </list>
> 	/// </para>
>-	///
>+	///
> 	/// <note>
> 	/// <para>
>-	/// For large or infinite numbers of backup files a <see
>cref="CountDirection"/>
>+	/// For large or infinite numbers of backup files a <see
>cref="CountDirection"/>
> 	/// greater than zero is highly recommended, otherwise all the
backup
>files need
> 	/// to be renamed each time a new backup is created.
> 	/// </para>
> 	/// <para>
>-	/// When Date/Time based rolling is used setting <see
>cref="StaticLogFileName"/>
>+	/// When Date/Time based rolling is used setting <see
>cref="StaticLogFileName"/>
> 	/// to <see langword="true"/> will reduce the number of file
>renamings to few or none.
> 	/// </para>
> 	/// </note>
>-	///
>+	///
> 	/// <note type="caution">
> 	/// <para>
> 	/// Changing <see cref="StaticLogFileName"/> or <see
>cref="CountDirection"/> without clearing
>-	/// the log file directory of backup files will cause unexpected and
>unwanted side effects.
>+	/// the log file directory of backup files will cause unexpected and
>unwanted side effects.
> 	/// </para>
> 	/// </note>
>-	///
>+	///
> 	/// <para>
> 	/// If Date/Time based rolling is enabled this appender will attempt
>to roll existing files
> 	/// in the directory without a Date/Time tag based on the last write
>date of the base log file.
>-	/// The appender only rolls the log file when a message is logged.
If
>Date/Time based rolling
>+	/// The appender only rolls the log file when a message is logged.
If
>Date/Time based rolling
> 	/// is enabled then the appender will not roll the log file at the
>Date/Time boundary but
> 	/// at the point when the next message is logged after the boundary
>has been crossed.
> 	/// </para>
>-	///
>+	///
> 	/// <para>
> 	/// The <see cref="RollingFileAppender"/> extends the <see
>cref="FileAppender"/> and
> 	/// has the same behavior when opening the log file.
>@@ -110,7 +110,7 @@
> 	/// When rolling a backup file necessitates deleting an older backup
>file the
> 	/// file to be deleted is moved to a temporary name before being
>deleted.
> 	/// </para>
>-	///
>+	///
> 	/// <note type="caution">
> 	/// <para>
> 	/// A maximum number of backup files when rolling on date/time
>boundaries is not supported.
>@@ -123,10 +123,10 @@
> 	/// <author>Douglas de la Torre</author>
> 	/// <author>Edward Smit</author>
> 	public class RollingFileAppender : FileAppender
>-    {
>-        #region Public Enums
>+	{
>+		#region Public Enums
>
>-        /// <summary>
>+		/// <summary>
> 		/// Style of rolling to use
> 		/// </summary>
> 		/// <remarks>
>@@ -231,7 +231,7 @@
> 		/// Default constructor.
> 		/// </para>
> 		/// </remarks>
>-		public RollingFileAppender()
>+		public RollingFileAppender()
> 		{
> 		}
>
>@@ -240,9 +240,9 @@
> 		#region Public Instance Properties
>
> #if !NET_1_0 && !CLI_1_0 && !NETCF
>-        /// <summary>
>+		/// <summary>
> 		/// Gets or sets the strategy for determining the current
date
>and time. The default
>-		/// implementation is to use LocalDateTime which internally
>calls through to DateTime.Now.
>+		/// implementation is to use LocalDateTime which internally
>calls through to DateTime.Now.
> 		/// DateTime.UtcNow may be used on frameworks newer than
.NET
>1.0 by specifying
> 		/// <see cref="RollingFileAppender.UniversalDateTime"/>.
> 		/// </summary>
>@@ -253,19 +253,19 @@
> 		/// <para>
> 		/// Gets or sets the <see
>cref="RollingFileAppender.IDateTime"/> used to return the current date and
>time.
> 		/// </para>
>-        /// <para>
>-        /// There are two built strategies for determining the current
>date and time,
>+		/// <para>
>+		/// There are two built strategies for determining the
current
>date and time,
> 		/// <see cref="RollingFileAppender.LocalDateTime"/>
>-        /// and <see cref="RollingFileAppender.UniversalDateTime"/>.
>-        /// </para>
>-        /// <para>
>+		/// and <see cref="RollingFileAppender.UniversalDateTime"/>.
>+		/// </para>
>+		/// <para>
> 		/// The default strategy is <see
>cref="RollingFileAppender.LocalDateTime"/>.
> 		/// </para>
> 		/// </remarks>
> #else
>-        /// <summary>
>+		/// <summary>
> 		/// Gets or sets the strategy for determining the current
date
>and time. The default
>-		/// implementation is to use LocalDateTime which internally
>calls through to DateTime.Now.
>+		/// implementation is to use LocalDateTime which internally
>calls through to DateTime.Now.
> 		/// </summary>
> 		/// <value>
> 		/// An implementation of the <see
>cref="RollingFileAppender.IDateTime"/> interface which returns the current
>date and time.
>@@ -274,12 +274,12 @@
> 		/// <para>
> 		/// Gets or sets the <see
>cref="RollingFileAppender.IDateTime"/> used to return the current date and
>time.
> 		/// </para>
>-        /// <para>
>+		/// <para>
> 		/// The default strategy is <see
>cref="RollingFileAppender.LocalDateTime"/>.
> 		/// </para>
> 		/// </remarks>
> #endif
>-        public IDateTime DateTimeStrategy
>+		public IDateTime DateTimeStrategy
> 		{
> 			get { return m_dateTime; }
> 			set { m_dateTime = value; }
>@@ -290,12 +290,12 @@
> 		/// when rolling over on date.
> 		/// </summary>
> 		/// <value>
>-		/// The date pattern to be used for generating file names
when
>rolling
>+		/// The date pattern to be used for generating file names
when
>rolling
> 		/// over on date.
> 		/// </value>
> 		/// <remarks>
> 		/// <para>
>-		/// Takes a string in the same format as expected by
>+		/// Takes a string in the same format as expected by
> 		/// <see cref="log4net.DateFormatter.SimpleDateFormatter"
/>.
> 		/// </para>
> 		/// <para>
>@@ -308,7 +308,7 @@
> 			get { return m_datePattern; }
> 			set { m_datePattern = value; }
> 		}
>-
>+
> 		/// <summary>
> 		/// Gets or sets the maximum number of backup files that are
>kept before
> 		/// the oldest is erased.
>@@ -319,16 +319,16 @@
> 		/// </value>
> 		/// <remarks>
> 		/// <para>
>-		/// If set to zero, then there will be no backup files and
the
>log file
>-		/// will be truncated when it reaches <see
>cref="MaxFileSize"/>.
>+		/// If set to zero, then there will be no backup files and
the
>log file
>+		/// will be truncated when it reaches <see
>cref="MaxFileSize"/>.
> 		/// </para>
> 		/// <para>
>-		/// If a negative number is supplied then no deletions will
be
>made.  Note
>-		/// that this could result in very slow performance as a
large
>number of
>+		/// If a negative number is supplied then no deletions will
be
>made.  Note
>+		/// that this could result in very slow performance as a
large
>number of
> 		/// files are rolled over unless <see
cref="CountDirection"/>
>is used.
> 		/// </para>
> 		/// <para>
>-		/// The maximum applies to <b>each</b> time based group of
>files and
>+		/// The maximum applies to <b>each</b> time based group of
>files and
> 		/// <b>not</b> the total.
> 		/// </para>
> 		/// </remarks>
>@@ -337,20 +337,20 @@
> 			get { return m_maxSizeRollBackups; }
> 			set { m_maxSizeRollBackups = value; }
> 		}
>-
>+
> 		/// <summary>
> 		/// Gets or sets the maximum size that the output file is
>allowed to reach
> 		/// before being rolled over to backup files.
> 		/// </summary>
> 		/// <value>
>-		/// The maximum size in bytes that the output file is
allowed
>to reach before being
>+		/// The maximum size in bytes that the output file is
allowed
>to reach before being
> 		/// rolled over to backup files.
> 		/// </value>
> 		/// <remarks>
> 		/// <para>
> 		/// This property is equivalent to <see
>cref="MaximumFileSize"/> except
> 		/// that it is required for differentiating the setter
taking a
>-		/// <see cref="long"/> argument from the setter taking a
<see
>cref="string"/>
>+		/// <see cref="long"/> argument from the setter taking a
<see
>cref="string"/>
> 		/// argument.
> 		/// </para>
> 		/// <para>
>@@ -362,20 +362,20 @@
> 			get { return m_maxFileSize; }
> 			set { m_maxFileSize = value; }
> 		}
>-
>+
> 		/// <summary>
> 		/// Gets or sets the maximum size that the output file is
>allowed to reach
> 		/// before being rolled over to backup files.
> 		/// </summary>
> 		/// <value>
>-		/// The maximum size that the output file is allowed to
reach
>before being
>+		/// The maximum size that the output file is allowed to
reach
>before being
> 		/// rolled over to backup files.
> 		/// </value>
> 		/// <remarks>
> 		/// <para>
> 		/// This property allows you to specify the maximum size
with
>the
>-		/// suffixes "KB", "MB" or "GB" so that the size is
interpreted
>being
>-		/// expressed respectively in kilobytes, megabytes or
>gigabytes.
>+		/// suffixes "KB", "MB" or "GB" so that the size is
interpreted
>being
>+		/// expressed respectively in kilobytes, megabytes or
>gigabytes.
> 		/// </para>
> 		/// <para>
> 		/// For example, the value "10KB" will be interpreted as
10240
>bytes.
>@@ -396,7 +396,7 @@
> 		}
>
> 		/// <summary>
>-		/// Gets or sets the rolling file count direction.
>+		/// Gets or sets the rolling file count direction.
> 		/// </summary>
> 		/// <value>
> 		/// The rolling file count direction.
>@@ -413,7 +413,7 @@
> 		/// <para>
> 		/// <see cref="CountDirection" /> &gt;= 0 does the opposite
>i.e.
> 		/// log.1 is the first backup made, log.5 is the 5th backup
>made, etc.
>-		/// For infinite backups use <see cref="CountDirection" />
>&gt;= 0 to reduce
>+		/// For infinite backups use <see cref="CountDirection" />
>&gt;= 0 to reduce
> 		/// rollover costs.
> 		/// </para>
> 		/// <para>The default file count direction is -1.</para>
>@@ -423,7 +423,7 @@
> 			get { return m_countDirection; }
> 			set { m_countDirection = value; }
> 		}
>-
>+
> 		/// <summary>
> 		/// Gets or sets the rolling style.
> 		/// </summary>
>@@ -445,7 +445,7 @@
> 			set
> 			{
> 				m_rollingStyle = value;
>-				switch (m_rollingStyle)
>+				switch (m_rollingStyle)
> 				{
> 					case RollingMode.Once:
> 						m_rollDate = false;
>@@ -467,30 +467,30 @@
> 					case RollingMode.Composite:
> 						m_rollDate = true;
> 						m_rollSize = true;
>-						break;
>+						break;
> 				}
> 			}
> 		}
>
>-        /// <summary>
>-        /// Gets or sets a value indicating whether to preserve the file
>name extension when rolling.
>-        /// </summary>
>-        /// <value>
>-        /// <c>true</c> if the file name extension should be preserved.
>-        /// </value>
>-        /// <remarks>
>-        /// <para>
>-        /// By default file.log is rolled to file.log.yyyy-MM-dd or
>file.log.curSizeRollBackup.
>-        /// However, under Windows the new file name will loose any
>program associations as the
>-        /// extension is changed. Optionally file.log can be renamed to
>file.yyyy-MM-dd.log or
>-        /// file.curSizeRollBackup.log to maintain any program
>associations.
>-        /// </para>
>-        /// </remarks>
>-        public bool PreserveLogFileNameExtension
>-        {
>-            get { return m_preserveLogFileNameExtension; }
>-            set { m_preserveLogFileNameExtension = value; }
>-        }
>+		/// <summary>
>+		/// Gets or sets a value indicating whether to preserve the
>file name extension when rolling.
>+		/// </summary>
>+		/// <value>
>+		/// <c>true</c> if the file name extension should be
preserved.
>+		/// </value>
>+		/// <remarks>
>+		/// <para>
>+		/// By default file.log is rolled to file.log.yyyy-MM-dd or
>file.log.curSizeRollBackup.
>+		/// However, under Windows the new file name will loose any
>program associations as the
>+		/// extension is changed. Optionally file.log can be renamed
to
>file.yyyy-MM-dd.log or
>+		/// file.curSizeRollBackup.log to maintain any program
>associations.
>+		/// </para>
>+		/// </remarks>
>+		public bool PreserveLogFileNameExtension
>+		{
>+			get { return m_preserveLogFileNameExtension; }
>+			set { m_preserveLogFileNameExtension = value; }
>+		}
>
> 		/// <summary>
> 		/// Gets or sets a value indicating whether to always log to
>@@ -507,7 +507,7 @@
> 		/// file.log.yyyy-mm-dd.curSizeRollBackup).
> 		/// </para>
> 		/// <para>
>-		/// This will make time based rollovers with a large number
of
>backups
>+		/// This will make time based rollovers with a large number
of
>backups
> 		/// much faster as the appender it won't have to rename all
the
>backups!
> 		/// </para>
> 		/// </remarks>
>@@ -519,21 +519,21 @@
>
> 		#endregion Public Instance Properties
>
>-	    #region Private Static Fields
>+		#region Private Static Fields
>
>-	    /// <summary>
>-	    /// The fully qualified type of the RollingFileAppender class.
>-	    /// </summary>
>-	    /// <remarks>
>-	    /// Used by the internal logger to record the Type of the
>-	    /// log message.
>-	    /// </remarks>
>-	    private readonly static Type declaringType =
>typeof(RollingFileAppender);
>+		/// <summary>
>+		/// The fully qualified type of the RollingFileAppender
class.
>+		/// </summary>
>+		/// <remarks>
>+		/// Used by the internal logger to record the Type of the
>+		/// log message.
>+		/// </remarks>
>+		private readonly static Type declaringType =
>typeof(RollingFileAppender);
>
>-	    #endregion Private Static Fields
>+		#endregion Private Static Fields
>
>-		#region Override implementation of FileAppender
>-
>+		#region Override implementation of FileAppender
>+
> 		/// <summary>
> 		/// Sets the quiet writer being used.
> 		/// </summary>
>@@ -541,7 +541,7 @@
> 		/// This method can be overridden by sub classes.
> 		/// </remarks>
> 		/// <param name="writer">the writer to set</param>
>-		override protected void SetQWForFiles(TextWriter writer)
>+		override protected void SetQWForFiles(TextWriter writer)
> 		{
> 			QuietWriter = new CountingQuietTextWriter(writer,
>ErrorHandler);
> 		}
>@@ -557,12 +557,12 @@
> 		/// is need and then appends to the file last.
> 		/// </para>
> 		/// </remarks>
>-		override protected void Append(LoggingEvent loggingEvent)
>+		override protected void Append(LoggingEvent loggingEvent)
> 		{
> 			AdjustFileBeforeAppend();
> 			base.Append(loggingEvent);
> 		}
>-
>+
>  		/// <summary>
> 		/// Write out an array of logging events.
> 		/// </summary>
>@@ -574,7 +574,7 @@
> 		/// is need and then appends to the file last.
> 		/// </para>
> 		/// </remarks>
>-		override protected void Append(LoggingEvent[] loggingEvents)
>+		override protected void Append(LoggingEvent[] loggingEvents)
> 		{
> 			AdjustFileBeforeAppend();
> 			base.Append(loggingEvents);
>@@ -592,21 +592,21 @@
> 		/// </remarks>
> 		virtual protected void AdjustFileBeforeAppend()
> 		{
>-			if (m_rollDate)
>+			if (m_rollDate)
> 			{
> 				DateTime n = m_dateTime.Now;
>-				if (n >= m_nextCheck)
>+				if (n >= m_nextCheck)
> 				{
> 					m_now = n;
> 					m_nextCheck = NextCheckDate(m_now,
>m_rollPoint);
>-
>+
> 					RollOverTime(true);
> 				}
> 			}
>-
>-			if (m_rollSize)
>+
>+			if (m_rollSize)
> 			{
>-				if ((File != null) &&
>((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
>+				if ((File != null) &&
>((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
> 				{
> 					RollOverSize();
> 				}
>@@ -631,7 +631,7 @@
>
> 				// Calculate the current size of the file
> 				long currentCount = 0;
>-				if (append)
>+				if (append)
> 				{
>
using(SecurityContext.Impersonate(this))
> 					{
>@@ -656,7 +656,7 @@
> 					}
> 				}
>
>-				if (!m_staticLogFileName)
>+				if (!m_staticLogFileName)
> 				{
> 					m_scheduledFilename = fileName;
> 				}
>@@ -676,25 +676,25 @@
> 		/// <returns>the output file name</returns>
> 		/// <remarks>
> 		/// The output file name is based on the base fileName
>specified.
>-		/// If <see cref="StaticLogFileName"/> is set then the
output
>+		/// If <see cref="StaticLogFileName"/> is set then the
output
> 		/// file name is the same as the base file passed in.
Otherwise
> 		/// the output file depends on the date pattern, on the
count
> 		/// direction or both.
> 		/// </remarks>
> 		protected string GetNextOutputFileName(string fileName)
> 		{
>-			if (!m_staticLogFileName)
>+			if (!m_staticLogFileName)
> 			{
> 				fileName = fileName.Trim();
>
> 				if (m_rollDate)
> 				{
>-                    fileName = CombinePath(fileName,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>+					fileName = CombinePath(fileName,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
> 				}
>
>-				if (m_countDirection >= 0)
>+				if (m_countDirection >= 0)
> 				{
>-                    fileName = CombinePath(fileName, "." +
>m_curSizeRollBackups);
>+					fileName = CombinePath(fileName, "."
+
>m_curSizeRollBackups);
> 				}
> 			}
>
>@@ -711,7 +711,7 @@
> 		private void DetermineCurSizeRollBackups()
> 		{
> 			m_curSizeRollBackups = 0;
>-
>+
> 			string fullPath = null;
> 			string fileName = null;
>
>@@ -735,14 +735,14 @@
> 		/// <returns></returns>
> 		private string GetWildcardPatternForFile(string
baseFileName)
> 		{
>-            if (m_preserveLogFileNameExtension)
>-            {
>-                return Path.GetFileNameWithoutExtension(baseFileName) +
>".*" + Path.GetExtension(baseFileName);
>-            }
>-            else
>-            {
>-                return baseFileName + '*';
>-            }
>+			if (m_preserveLogFileNameExtension)
>+			{
>+				return
>Path.GetFileNameWithoutExtension(baseFileName) + ".*" +
>Path.GetExtension(baseFileName);
>+			}
>+			else
>+			{
>+				return baseFileName + '*';
>+			}
> 		}
>
> 		/// <summary>
>@@ -767,10 +767,10 @@
> 					string baseFileName =
>Path.GetFileName(fullPath);
>
> 					string[] files =
>Directory.GetFiles(directory, GetWildcardPatternForFile(baseFileName));
>-
>+
> 					if (files != null)
> 					{
>-						for (int i = 0; i <
files.Length; i++)
>+						for (int i = 0; i <
files.Length; i++)
> 						{
> 							string curFileName =
>Path.GetFileName(files[i]);
> 							if
>(curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFileName)))
>@@ -790,14 +790,15 @@
> 		/// </summary>
> 		private void RollOverIfDateBoundaryCrossing()
> 		{
>-			if (m_staticLogFileName && m_rollDate)
>+			if (m_staticLogFileName && m_rollDate)
> 			{
>-				if (FileExists(m_baseFileName))
>+				if (FileExists(m_baseFileName))
> 				{
> 					DateTime last;
>-
using(SecurityContext.Impersonate(this)) {
>+
using(SecurityContext.Impersonate(this))
>+					{
> #if !NET_1_0 && !CLI_1_0 && !NETCF
>-                        if (DateTimeStrategy is UniversalDateTime)
>+						if (DateTimeStrategy is
>UniversalDateTime)
> 						{
> 							last =
>System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
> 						}
>@@ -806,12 +807,12 @@
> #endif
> 							last =
>System.IO.File.GetLastWriteTime(m_baseFileName);
> #if !NET_1_0 && !CLI_1_0 && !NETCF
>-                        }
>+						}
> #endif
>-                    }
>+					}
> 					LogLog.Debug(declaringType,
>"["+last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inv
>ariantInfo)+"] vs.
>["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inv
>ariantInfo)+"]");
>
>-					if
>(!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inva
>riantInfo).Equals(m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo))))
>+					if
>(!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.Inva
>riantInfo).Equals(m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo))))
> 					{
> 						m_scheduledFilename =
m_baseFileName +
>last.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo);
> 						LogLog.Debug(declaringType,
"Initial
>roll over to ["+m_scheduledFilename+"]");
>@@ -835,7 +836,7 @@
> 		///	</list>
> 		///	</para>
> 		/// </remarks>
>-		protected void ExistingInit()
>+		protected void ExistingInit()
> 		{
> 			DetermineCurSizeRollBackups();
> 			RollOverIfDateBoundaryCrossing();
>@@ -878,29 +879,29 @@
> 		/// <param name="curFileName"></param>
> 		private void InitializeFromOneFile(string baseFile, string
>curFileName)
> 		{
>-            if
>(curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)) ==
>false)
>+			if (!
>curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)))
> 			{
> 				// This is not a log file, so ignore
> 				return;
> 			}
>-			if (curFileName.Equals(baseFile))
>+			if (curFileName.Equals(baseFile))
> 			{
> 				// Base log file is not an incremented
logfile (.1
>or .2, etc)
> 				return;
> 			}
>-
>-            /*
>-			if (m_staticLogFileName)
>+
>+			/*
>+			if (m_staticLogFileName)
> 			{
> 				int endLength = curFileName.Length - index;
>-				if (baseFile.Length + endLength !=
>curFileName.Length)
>+				if (baseFile.Length + endLength !=
>curFileName.Length)
> 				{
> 					// file is probably
scheduledFilename + .x so
>I don't care
> 					return;
> 				}
> 			}
>-            */
>-
>+			*/
>+
> 			// Only look for files in the current roll point
> 			if (m_rollDate && !m_staticLogFileName)
> 			{
>@@ -910,48 +911,48 @@
> 					return;
> 				}
> 			}
>-
>-			try
>+
>+			try
> 			{
> 				// Bump the counter up to the highest count
seen so
>far
>-                int backup = GetBackUpIndex(curFileName);
>-
>-                // caution: we might get a false positive when certain
>-                // date patterns such as yyyyMMdd are used...those are
>-                // valid number but aren't the kind of back up index
>-                // we're looking for
>-                if (backup > m_curSizeRollBackups)
>-                {
>-                    if (0 == m_maxSizeRollBackups)
>-                    {
>-                        // Stay at zero when zero backups are desired
>-                    }
>-                    else if (-1 == m_maxSizeRollBackups)
>-                    {
>-                        // Infinite backups, so go as high as the highest
>value
>-                        m_curSizeRollBackups = backup;
>-                    }
>-                    else
>-                    {
>-                        // Backups limited to a finite number
>-                        if (m_countDirection >= 0)
>-                        {
>-                            // Go with the highest file when counting up
>-                            m_curSizeRollBackups = backup;
>-                        }
>-                        else
>-                        {
>-                            // Clip to the limit when counting down
>-                            if (backup <= m_maxSizeRollBackups)
>-                            {
>-                                m_curSizeRollBackups = backup;
>-                            }
>-                        }
>-                    }
>-                    LogLog.Debug(declaringType, "File name [" +
>curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
>-                }
>-			}
>-			catch(FormatException)
>+				int backup = GetBackUpIndex(curFileName);
>+
>+				// caution: we might get a false positive
when
>certain
>+				// date patterns such as yyyyMMdd are
used...those
>are
>+				// valid number but aren't the kind of back
up
>index
>+				// we're looking for
>+				if (backup > m_curSizeRollBackups)
>+				{
>+					if (0 == m_maxSizeRollBackups)
>+					{
>+						// Stay at zero when zero
backups are
>desired
>+					}
>+					else if (-1 == m_maxSizeRollBackups)
>+					{
>+						// Infinite backups, so go
as high as
>the highest value
>+						m_curSizeRollBackups =
backup;
>+					}
>+					else
>+					{
>+						// Backups limited to a
finite number
>+						if (m_countDirection >= 0)
>+						{
>+							// Go with the
highest file when
>counting up
>+							m_curSizeRollBackups
= backup;
>+						}
>+						else
>+						{
>+							// Clip to the limit
when
>counting down
>+							if (backup <=
>m_maxSizeRollBackups)
>+							{
>+
m_curSizeRollBackups =
>backup;
>+							}
>+						}
>+					}
>+					LogLog.Debug(declaringType, "File
name [" +
>curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
>+				}
>+			}
>+			catch(FormatException)
> 			{
> 				//this happens when file.log ->
file.log.yyyy-MM-dd
>which is normal
> 				//when staticLogFileName == false
>@@ -959,38 +960,38 @@
> 			}
> 		}
>
>-        /// <summary>
>-        /// Attempts to extract a number from the end of the file name
>that indicates
>-        /// the number of the times the file has been rolled over.
>-        /// </summary>
>-        /// <remarks>
>-        /// Certain date pattern extensions like yyyyMMdd will be parsed
>as valid backup indexes.
>-        /// </remarks>
>-        /// <param name="curFileName"></param>
>-        /// <returns></returns>
>-	    private int GetBackUpIndex(string curFileName)
>-	    {
>-            int backUpIndex = -1;
>-            string fileName = curFileName;
>+		/// <summary>
>+		/// Attempts to extract a number from the end of the file
name
>that indicates
>+		/// the number of the times the file has been rolled over.
>+		/// </summary>
>+		/// <remarks>
>+		/// Certain date pattern extensions like yyyyMMdd will be
>parsed as valid backup indexes.
>+		/// </remarks>
>+		/// <param name="curFileName"></param>
>+		/// <returns></returns>
>+		private int GetBackUpIndex(string curFileName)
>+		{
>+			int backUpIndex = -1;
>+			string fileName = curFileName;
>
>-            if (m_preserveLogFileNameExtension)
>-            {
>-                fileName = Path.GetFileNameWithoutExtension(fileName);
>-            }
>-
>-            int index = fileName.LastIndexOf(".");
>-            if (index > 0)
>-            {
>-                // 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
>-                SystemInfo.TryParse(fileName.Substring(index + 1), out
>backUpIndex);
>-            }
>+			if (m_preserveLogFileNameExtension)
>+			{
>+				fileName =
>Path.GetFileNameWithoutExtension(fileName);
>+			}
>
>-            return backUpIndex;
>-	    }
>+			int index = fileName.LastIndexOf(".");
>+			if (index > 0)
>+			{
>+				// 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
>+				SystemInfo.TryParse(fileName.Substring(index
+ 1),
>out backUpIndex);
>+			}
>
>-	    /// <summary>
>-		/// Takes a list of files and a base file name, and looks
for
>+			return backUpIndex;
>+		}
>+
>+		/// <summary>
>+		/// Takes a list of files and a base file name, and looks
for
> 		/// 'incremented' versions of the base file.  Bumps the max
> 		/// count up to the highest count seen.
> 		/// </summary>
>@@ -1018,13 +1019,13 @@
> 		/// Essentially the date pattern is examined to determine
what
>the
> 		/// most suitable roll point is. The roll point chosen is
the
>roll point
> 		/// with the smallest period that can be detected using the
>date pattern
>-		/// supplied. i.e. if the date pattern only outputs the
year,
>month, day
>+		/// supplied. i.e. if the date pattern only outputs the
year,
>month, day
> 		/// and hour then the smallest roll point that can be
detected
>would be
> 		/// and hourly roll point as minutes could not be detected.
> 		/// </remarks>
>-		private RollPoint ComputeCheckPeriod(string datePattern)
>+		private RollPoint ComputeCheckPeriod(string datePattern)
> 		{
>-			// s_date1970 is 1970-01-01 00:00:00 this is
>UniversalSortableDateTimePattern
>+			// s_date1970 is 1970-01-01 00:00:00 this is
>UniversalSortableDateTimePattern
> 			// (based on ISO 8601) using universal time. This
date is
>used for reference
> 			// purposes to calculate the resolution of the date
>pattern.
>
>@@ -1032,7 +1033,7 @@
> 			string r0 = s_date1970.ToString(datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>
> 			// Check each type of rolling mode starting with the
>smallest increment.
>-			for(int i = (int)RollPoint.TopOfMinute; i <=
>(int)RollPoint.TopOfMonth; i++)
>+			for(int i = (int)RollPoint.TopOfMinute; i <=
>(int)RollPoint.TopOfMonth; i++)
> 			{
> 				// Get string representation of next pattern
> 				string r1 = NextCheckDate(s_date1970,
>(RollPoint)i).ToString(datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>@@ -1040,7 +1041,7 @@
> 				LogLog.Debug(declaringType, "Type = ["+i+"],
r0 =
>["+r0+"], r1 = ["+r1+"]");
>
> 				// Check if the string representations are
>different
>-				if (r0 != null && r1 != null &&
!r0.Equals(r1))
>+				if (r0 != null && r1 != null &&
!r0.Equals(r1))
> 				{
> 					// Found highest precision roll
point
> 					return (RollPoint)i;
>@@ -1056,13 +1057,13 @@
> 		/// <remarks>
> 		/// <para>
> 		/// This is part of the <see cref="IOptionHandler"/> delayed
>object
>-		/// activation scheme. The <see cref="ActivateOptions"/>
method
>must
>+		/// activation scheme. The <see cref="ActivateOptions"/>
method
>must
> 		/// be called on this object after the configuration
properties
>have
> 		/// been set. Until <see cref="ActivateOptions"/> is called
>this
>-		/// object is in an undefined state and must not be used.
>+		/// object is in an undefined state and must not be used.
> 		/// </para>
> 		/// <para>
>-		/// If any of the configuration properties are modified then
>+		/// If any of the configuration properties are modified then
> 		/// <see cref="ActivateOptions"/> must be called again.
> 		/// </para>
> 		/// <para>
>@@ -1071,14 +1072,14 @@
> 		/// the current number of backups.
> 		/// </para>
> 		/// </remarks>
>-		override public void ActivateOptions()
>+		override public void ActivateOptions()
> 		{
> 			if (m_dateTime == null)
> 			{
> 				m_dateTime = new LocalDateTime();
> 			}
>
>-			if (m_rollDate && m_datePattern != null)
>+			if (m_rollDate && m_datePattern != null)
> 			{
> 				m_now = m_dateTime.Now;
> 				m_rollPoint =
ComputeCheckPeriod(m_datePattern);
>@@ -1090,8 +1091,8 @@
>
> 				// next line added as this removes the name
check
>in rollOver
> 				m_nextCheck = NextCheckDate(m_now,
m_rollPoint);
>-			}
>-			else
>+			}
>+			else
> 			{
> 				if (m_rollDate)
> 				{
>@@ -1117,36 +1118,36 @@
>
> 			if (m_rollDate && File != null &&
m_scheduledFilename ==
>null)
> 			{
>-                m_scheduledFilename = CombinePath(File,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>+				m_scheduledFilename = CombinePath(File,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
> 			}
>
> 			ExistingInit();
>-
>+
> 			base.ActivateOptions();
> 		}
>
> 		#endregion
>-
>+
> 		#region Roll File
>
>-        /// <summary>
>-        ///
>-        /// </summary>
>-        /// <param name="path1"></param>
>-        /// <param name="path2">.1, .2, .3, etc.</param>
>-        /// <returns></returns>
>-        private string CombinePath(string path1, string path2)
>-        {
>-            string extension = Path.GetExtension(path1);
>-            if (m_preserveLogFileNameExtension && extension.Length > 0)
>-            {
>-                return Path.Combine(Path.GetDirectoryName(path1),
>Path.GetFileNameWithoutExtension(path1) + path2 + extension);
>-            }
>-            else
>-            {
>-                return path1 + path2;
>-            }
>-        }
>+		/// <summary>
>+		///
>+		/// </summary>
>+		/// <param name="path1"></param>
>+		/// <param name="path2">.1, .2, .3, etc.</param>
>+		/// <returns></returns>
>+		private string CombinePath(string path1, string path2)
>+		{
>+			string extension = Path.GetExtension(path1);
>+			if (m_preserveLogFileNameExtension &&
extension.Length >
>0)
>+			{
>+				return
Path.Combine(Path.GetDirectoryName(path1),
>Path.GetFileNameWithoutExtension(path1) + path2 + extension);
>+			}
>+			else
>+			{
>+				return path1 + path2;
>+			}
>+		}
>
> 		/// <summary>
> 		/// Rollover the file(s) to date/time tagged file(s).
>@@ -1155,53 +1156,53 @@
> 		/// <remarks>
> 		/// <para>
> 		/// Rollover the file(s) to date/time tagged file(s).
>-		/// Resets curSizeRollBackups.
>+		/// Resets curSizeRollBackups.
> 		/// If fileIsOpen is set then the new file is opened
(through
>SafeOpenFile).
> 		/// </para>
> 		/// </remarks>
>-		protected void RollOverTime(bool fileIsOpen)
>+		protected void RollOverTime(bool fileIsOpen)
> 		{
>-			if (m_staticLogFileName)
>+			if (m_staticLogFileName)
> 			{
> 				// Compute filename, but only if datePattern
is
>specified
>-				if (m_datePattern == null)
>+				if (m_datePattern == null)
> 				{
> 					ErrorHandler.Error("Missing
DatePattern
>option in rollOver().");
> 					return;
> 				}
>-
>+
> 				//is the new file name equivalent to the
'current'
>one
> 				//something has gone wrong if we hit this --
we
>should only
> 				//roll over if the new file will be
different from
>the old
> 				string dateFormat =
m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo);
>-                if (m_scheduledFilename.Equals(CombinePath(File,
>dateFormat)))
>+				if
(m_scheduledFilename.Equals(CombinePath(File,
>dateFormat)))
> 				{
>-                    ErrorHandler.Error("Compare " + m_scheduledFilename +
>" : " + CombinePath(File, dateFormat));
>+					ErrorHandler.Error("Compare " +
>m_scheduledFilename + " : " + CombinePath(File, dateFormat));
> 					return;
> 				}
>-
>+
> 				if (fileIsOpen)
> 				{
> 					// close current file, and rename it
to
>datedFilename
> 					this.CloseFile();
> 				}
>-
>+
> 				//we may have to roll over a large number of
>backups here
>-				for (int i = 1; i <= m_curSizeRollBackups;
i++)
>+				for (int i = 1; i <= m_curSizeRollBackups;
i++)
> 				{
>-                    string from = CombinePath(File, "." + i);
>-                    string to = CombinePath(m_scheduledFilename, "." + i);
>+					string from = CombinePath(File, "."
+ i);
>+					string to =
CombinePath(m_scheduledFilename,
>"." + i);
> 					RollFile(from, to);
> 				}
>-
>+
> 				RollFile(File, m_scheduledFilename);
> 			}
>-
>+
> 			//We've cleared out the old date and are ready for
the
>new
>-			m_curSizeRollBackups = 0;
>-
>+			m_curSizeRollBackups = 0;
>+
> 			//new scheduled name
>-            m_scheduledFilename = CombinePath(File,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>+			m_scheduledFilename = CombinePath(File,
>m_now.ToString(m_datePattern,
>System.Globalization.DateTimeFormatInfo.InvariantInfo));
>
> 			if (fileIsOpen)
> 			{
>@@ -1209,7 +1210,7 @@
> 				SafeOpenFile(m_baseFileName, false);
> 			}
> 		}
>-
>+
> 		/// <summary>
> 		/// Renames file <paramref name="fromFile"/> to file
<paramref
>name="toFile"/>.
> 		/// </summary>
>@@ -1221,7 +1222,7 @@
> 		/// also checks for existence of target file and deletes if
it
>does.
> 		/// </para>
> 		/// </remarks>
>-		protected void RollFile(string fromFile, string toFile)
>+		protected void RollFile(string fromFile, string toFile)
> 		{
> 			if (FileExists(fromFile))
> 			{
>@@ -1265,7 +1266,7 @@
> 				return System.IO.File.Exists(path);
> 			}
> 		}
>-
>+
> 		/// <summary>
> 		/// Deletes the specified file if it exists.
> 		/// </summary>
>@@ -1278,9 +1279,9 @@
> 		/// be deleted, but it still can be moved.
> 		/// </para>
> 		/// </remarks>
>-		protected void DeleteFile(string fileName)
>+		protected void DeleteFile(string fileName)
> 		{
>-			if (FileExists(fileName))
>+			if (FileExists(fileName))
> 			{
> 				// We may not have permission to delete the
file,
>or the file may be locked
>
>@@ -1327,7 +1328,7 @@
> 				}
> 			}
> 		}
>-
>+
> 		/// <summary>
> 		/// Implements file roll base on file size.
> 		/// </summary>
>@@ -1354,18 +1355,18 @@
> 		/// renamed if needed and no files are deleted.
> 		/// </para>
> 		/// </remarks>
>-		protected void RollOverSize()
>+		protected void RollOverSize()
> 		{
> 			this.CloseFile(); // keep windows happy.
>-
>+
> 			LogLog.Debug(declaringType, "rolling over count
>["+((CountingQuietTextWriter)QuietWriter).Count+"]");
> 			LogLog.Debug(declaringType, "maxSizeRollBackups
>["+m_maxSizeRollBackups+"]");
> 			LogLog.Debug(declaringType, "curSizeRollBackups
>["+m_curSizeRollBackups+"]");
> 			LogLog.Debug(declaringType, "countDirection
>["+m_countDirection+"]");
>
> 			RollOverRenameFiles(File);
>-
>-			if (!m_staticLogFileName && m_countDirection >= 0)
>+
>+			if (!m_staticLogFileName && m_countDirection >= 0)
> 			{
> 				m_curSizeRollBackups++;
> 			}
>@@ -1386,7 +1387,7 @@
> 		/// If <c>countDirection</c> &lt; 0, then files
> 		/// {<c>File.1</c>, ..., <c>File.curSizeRollBackups -1</c>}
> 		/// are renamed to {<c>File.2</c>, ...,
>-		/// <c>File.curSizeRollBackups</c>}.
>+		/// <c>File.curSizeRollBackups</c>}.
> 		/// </para>
> 		/// <para>
> 		/// If <c>maxSizeRollBackups</c> is equal to zero, then the
>@@ -1400,35 +1401,35 @@
> 		/// This is called by <see cref="RollOverSize"/> to rename
the
>files.
> 		/// </para>
> 		/// </remarks>
>-		protected void RollOverRenameFiles(string baseFileName)
>+		protected void RollOverRenameFiles(string baseFileName)
> 		{
> 			// If maxBackups <= 0, then there is no file
renaming to
>be done.
>-			if (m_maxSizeRollBackups != 0)
>+			if (m_maxSizeRollBackups != 0)
> 			{
>-				if (m_countDirection < 0)
>+				if (m_countDirection < 0)
> 				{
> 					// Delete the oldest file, to keep
Windows
>happy.
>-					if (m_curSizeRollBackups ==
>m_maxSizeRollBackups)
>+					if (m_curSizeRollBackups ==
>m_maxSizeRollBackups)
> 					{
>-                        DeleteFile(CombinePath(baseFileName, "." +
>m_maxSizeRollBackups));
>+
DeleteFile(CombinePath(baseFileName,
>"." + m_maxSizeRollBackups));
> 						m_curSizeRollBackups--;
> 					}
>-
>+
> 					// Map {(maxBackupIndex - 1), ...,
2, 1} to
>{maxBackupIndex, ..., 3, 2}
>-					for (int i = m_curSizeRollBackups; i
>= 1; i-
>-)
>+					for (int i = m_curSizeRollBackups; i
>= 1; i-
>-)
> 					{
>-                        RollFile((CombinePath(baseFileName, "." + i)),
>(CombinePath(baseFileName, "." + (i + 1))));
>+
RollFile((CombinePath(baseFileName, "."
>+ i)), (CombinePath(baseFileName, "." + (i + 1))));
> 					}
>-
>+
> 					m_curSizeRollBackups++;
>
> 					// Rename fileName to fileName.1
>-                    RollFile(baseFileName, CombinePath(baseFileName,
>".1"));
>-				}
>-				else
>+					RollFile(baseFileName,
>CombinePath(baseFileName, ".1"));
>+				}
>+				else
> 				{
> 					//countDirection >= 0
>-					if (m_curSizeRollBackups >=
>m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
>+					if (m_curSizeRollBackups >=
>m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
> 					{
> 						//delete the first and keep
counting
>up.
> 						int oldestFileIndex =
>m_curSizeRollBackups - m_maxSizeRollBackups;
>@@ -1446,20 +1447,20 @@
> 						if (!m_staticLogFileName)
> 						{
> 							int lastDotIndex =
>archiveFileBaseName.LastIndexOf(".");
>-							if (lastDotIndex >=
0)
>+							if (lastDotIndex >=
0)
> 							{
>
archiveFileBaseName =
>archiveFileBaseName.Substring(0, lastDotIndex);
> 							}
> 						}
>
> 						// Delete the archive file
>-                        DeleteFile(CombinePath(archiveFileBaseName, "." +
>oldestFileIndex));
>+
>	DeleteFile(CombinePath(archiveFileBaseName, "." + oldestFileIndex));
> 					}
>-
>-					if (m_staticLogFileName)
>+
>+					if (m_staticLogFileName)
> 					{
> 						m_curSizeRollBackups++;
>-                        RollFile(baseFileName, CombinePath(baseFileName,
>"." + m_curSizeRollBackups));
>+						RollFile(baseFileName,
>CombinePath(baseFileName, "." + m_curSizeRollBackups));
> 					}
> 				}
> 			}
>@@ -1486,13 +1487,13 @@
> 		/// worth of time and get the start time of the next window
for
>the rollpoint.
> 		/// </para>
> 		/// </remarks>
>-		protected DateTime NextCheckDate(DateTime currentDateTime,
>RollPoint rollPoint)
>+		protected DateTime NextCheckDate(DateTime currentDateTime,
>RollPoint rollPoint)
> 		{
> 			// Local variable to work on (this does not look
very
>efficient)
> 			DateTime current = currentDateTime;
>
> 			// Do slightly different things depending on what
the
>type of roll point we want.
>-			switch(rollPoint)
>+			switch(rollPoint)
> 			{
> 				case RollPoint.TopOfMinute:
> 					current = current.AddMilliseconds(-
>current.Millisecond);
>@@ -1512,11 +1513,11 @@
> 					current = current.AddSeconds(-
>current.Second);
> 					current = current.AddMinutes(-
>current.Minute);
>
>-					if (current.Hour < 12)
>+					if (current.Hour < 12)
> 					{
> 						current =
current.AddHours(12 -
>current.Hour);
>-					}
>-					else
>+					}
>+					else
> 					{
> 						current = current.AddHours(-
>current.Hour);
> 						current =
current.AddDays(1);
>@@ -1547,7 +1548,7 @@
> 					current = current.AddDays(1 -
current.Day);
>/* first day of month is 1 not 0 */
> 					current = current.AddMonths(1);
> 					break;
>-			}
>+			}
> 			return current;
> 		}
>
>@@ -1563,38 +1564,38 @@
> 		private IDateTime m_dateTime = null;
>
> 		/// <summary>
>-		/// The date pattern. By default, the pattern is set to
><c>".yyyy-MM-dd"</c>
>+		/// The date pattern. By default, the pattern is set to
><c>".yyyy-MM-dd"</c>
> 		/// meaning daily rollover.
> 		/// </summary>
> 		private string m_datePattern = ".yyyy-MM-dd";
>-
>+
> 		/// <summary>
> 		/// The actual formatted filename that is currently being
>written to
> 		/// or will be the file transferred to on roll over
> 		/// (based on staticLogFileName).
> 		/// </summary>
> 		private string m_scheduledFilename = null;
>-
>+
> 		/// <summary>
> 		/// The timestamp when we shall next recompute the filename.
> 		/// </summary>
> 		private DateTime m_nextCheck = DateTime.MaxValue;
>-
>+
> 		/// <summary>
> 		/// Holds date of last roll over
> 		/// </summary>
> 		private DateTime m_now;
>-
>+
> 		/// <summary>
> 		/// The type of rolling done
> 		/// </summary>
> 		private RollPoint m_rollPoint;
>-
>+
> 		/// <summary>
> 		/// The default maximum file size is 10MB
> 		/// </summary>
> 		private long m_maxFileSize = 10*1024*1024;
>-
>+
> 		/// <summary>
> 		/// There is zero backup files by default
> 		/// </summary>
>@@ -1604,12 +1605,12 @@
> 		/// How many sized based backups have been made so far
> 		/// </summary>
> 		private int m_curSizeRollBackups = 0;
>-
>+
> 		/// <summary>
>-		/// The rolling file count direction.
>+		/// The rolling file count direction.
> 		/// </summary>
> 		private int m_countDirection = -1;
>-
>+
> 		/// <summary>
> 		/// The rolling mode used in this appender.
> 		/// </summary>
>@@ -1624,13 +1625,13 @@
> 		/// Cache flag set if we are rolling by size.
> 		/// </summary>
> 		private bool m_rollSize = true;
>-
>+
> 		/// <summary>
> 		/// Value indicating whether to always log to the same file.
> 		/// </summary>
> 		private bool m_staticLogFileName = true;
>-
>-   		/// <summary>
>+
>+		/// <summary>
> 		/// Value indicating whether to preserve the file name
>extension when rolling.
> 		/// </summary>
> 		private bool m_preserveLogFileNameExtension = false;
>@@ -1640,7 +1641,7 @@
> 		/// FileName provided in configuration.  Used for rolling
>properly
> 		/// </summary>
> 		private string m_baseFileName;
>-
>+
> 		#endregion Private Instance Fields
>
> 		#region Static Members
>@@ -1697,7 +1698,7 @@
> 		}
>
> #if !NET_1_0 && !CLI_1_0 && !NETCF
>-        /// <summary>
>+		/// <summary>
> 		/// Implementation of <see cref="IDateTime"/> that returns
the
>current time as the coordinated universal time (UTC).
> 		/// </summary>
> 		private class UniversalDateTime : IDateTime
>@@ -1718,6 +1719,6 @@
> 		}
> #endif
>
>-        #endregion DateTime
>+		#endregion DateTime
> 	}
> }


[PATCH 1 of 5] Step 1: refactoring

Posted by Dominik Psenner <dp...@gmail.com>.
Trivial changes to tabs and spaces, formatting etc.

diff -r b430bc3cc0f4 -r dc18d71a5304 src/Appender/RollingFileAppender.cs
--- a/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:27:20 2013 +0100
+++ b/src/Appender/RollingFileAppender.cs	Tue Jan 22 14:31:05 2013 +0100
@@ -1,10 +1,10 @@
 #region Apache License
 //
-// Licensed to the Apache Software Foundation (ASF) under one or more 
+// Licensed to the Apache Software Foundation (ASF) under one or more
 // contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership. 
+// this work for additional information regarding copyright ownership.
 // The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with 
+// (the "License"); you may not use this file except in compliance with
 // the License. You may obtain a copy of the License at
 //
 // http://www.apache.org/licenses/LICENSE-2.0
@@ -31,12 +31,12 @@
 	// The following sounds good, and I though it was the case, but after
 	// further testing on Windows I have not been able to confirm it.
 
-	/// On the Windows platform if another process has a write lock on the file 
+	/// On the Windows platform if another process has a write lock on the file
 	/// that is to be deleted, but allows shared read access to the file then the
-	/// file can be moved, but cannot be deleted. If the other process also allows 
-	/// shared delete access to the file then the file will be deleted once that 
+	/// file can be moved, but cannot be deleted. If the other process also allows
+	/// shared delete access to the file then the file will be deleted once that
 	/// process closes the file. If it is necessary to open the log file or any
-	/// of the backup files outside of this appender for either read or 
+	/// of the backup files outside of this appender for either read or
 	/// write access please ensure that read and delete share modes are enabled.
 #endif
 
@@ -68,34 +68,34 @@
 	/// <item>Infinite number of backups by file size <see cref="MaxSizeRollBackups"/></item>
 	/// </list>
 	/// </para>
-	/// 
+	///
 	/// <note>
 	/// <para>
-	/// For large or infinite numbers of backup files a <see cref="CountDirection"/> 
+	/// For large or infinite numbers of backup files a <see cref="CountDirection"/>
 	/// greater than zero is highly recommended, otherwise all the backup files need
 	/// to be renamed each time a new backup is created.
 	/// </para>
 	/// <para>
-	/// When Date/Time based rolling is used setting <see cref="StaticLogFileName"/> 
+	/// When Date/Time based rolling is used setting <see cref="StaticLogFileName"/>
 	/// to <see langword="true"/> will reduce the number of file renamings to few or none.
 	/// </para>
 	/// </note>
-	/// 
+	///
 	/// <note type="caution">
 	/// <para>
 	/// Changing <see cref="StaticLogFileName"/> or <see cref="CountDirection"/> without clearing
-	/// the log file directory of backup files will cause unexpected and unwanted side effects.  
+	/// the log file directory of backup files will cause unexpected and unwanted side effects.
 	/// </para>
 	/// </note>
-	/// 
+	///
 	/// <para>
 	/// If Date/Time based rolling is enabled this appender will attempt to roll existing files
 	/// in the directory without a Date/Time tag based on the last write date of the base log file.
-	/// The appender only rolls the log file when a message is logged. If Date/Time based rolling 
+	/// The appender only rolls the log file when a message is logged. If Date/Time based rolling
 	/// is enabled then the appender will not roll the log file at the Date/Time boundary but
 	/// at the point when the next message is logged after the boundary has been crossed.
 	/// </para>
-	/// 
+	///
 	/// <para>
 	/// The <see cref="RollingFileAppender"/> extends the <see cref="FileAppender"/> and
 	/// has the same behavior when opening the log file.
@@ -110,7 +110,7 @@
 	/// When rolling a backup file necessitates deleting an older backup file the
 	/// file to be deleted is moved to a temporary name before being deleted.
 	/// </para>
-	/// 
+	///
 	/// <note type="caution">
 	/// <para>
 	/// A maximum number of backup files when rolling on date/time boundaries is not supported.
@@ -123,10 +123,10 @@
 	/// <author>Douglas de la Torre</author>
 	/// <author>Edward Smit</author>
 	public class RollingFileAppender : FileAppender
-    {
-        #region Public Enums
+	{
+		#region Public Enums
 
-        /// <summary>
+		/// <summary>
 		/// Style of rolling to use
 		/// </summary>
 		/// <remarks>
@@ -231,7 +231,7 @@
 		/// Default constructor.
 		/// </para>
 		/// </remarks>
-		public RollingFileAppender() 
+		public RollingFileAppender()
 		{
 		}
 
@@ -240,9 +240,9 @@
 		#region Public Instance Properties
 
 #if !NET_1_0 && !CLI_1_0 && !NETCF
-        /// <summary>
+		/// <summary>
 		/// Gets or sets the strategy for determining the current date and time. The default
-		/// implementation is to use LocalDateTime which internally calls through to DateTime.Now. 
+		/// implementation is to use LocalDateTime which internally calls through to DateTime.Now.
 		/// DateTime.UtcNow may be used on frameworks newer than .NET 1.0 by specifying
 		/// <see cref="RollingFileAppender.UniversalDateTime"/>.
 		/// </summary>
@@ -253,19 +253,19 @@
 		/// <para>
 		/// Gets or sets the <see cref="RollingFileAppender.IDateTime"/> used to return the current date and time.
 		/// </para>
-        /// <para>
-        /// There are two built strategies for determining the current date and time, 
+		/// <para>
+		/// There are two built strategies for determining the current date and time,
 		/// <see cref="RollingFileAppender.LocalDateTime"/>
-        /// and <see cref="RollingFileAppender.UniversalDateTime"/>.
-        /// </para>
-        /// <para>
+		/// and <see cref="RollingFileAppender.UniversalDateTime"/>.
+		/// </para>
+		/// <para>
 		/// The default strategy is <see cref="RollingFileAppender.LocalDateTime"/>.
 		/// </para>
 		/// </remarks>
 #else
-        /// <summary>
+		/// <summary>
 		/// Gets or sets the strategy for determining the current date and time. The default
-		/// implementation is to use LocalDateTime which internally calls through to DateTime.Now. 
+		/// implementation is to use LocalDateTime which internally calls through to DateTime.Now.
 		/// </summary>
 		/// <value>
 		/// An implementation of the <see cref="RollingFileAppender.IDateTime"/> interface which returns the current date and time.
@@ -274,12 +274,12 @@
 		/// <para>
 		/// Gets or sets the <see cref="RollingFileAppender.IDateTime"/> used to return the current date and time.
 		/// </para>
-        /// <para>
+		/// <para>
 		/// The default strategy is <see cref="RollingFileAppender.LocalDateTime"/>.
 		/// </para>
 		/// </remarks>
 #endif
-        public IDateTime DateTimeStrategy
+		public IDateTime DateTimeStrategy
 		{
 			get { return m_dateTime; }
 			set { m_dateTime = value; }
@@ -290,12 +290,12 @@
 		/// when rolling over on date.
 		/// </summary>
 		/// <value>
-		/// The date pattern to be used for generating file names when rolling 
+		/// The date pattern to be used for generating file names when rolling
 		/// over on date.
 		/// </value>
 		/// <remarks>
 		/// <para>
-		/// Takes a string in the same format as expected by 
+		/// Takes a string in the same format as expected by
 		/// <see cref="log4net.DateFormatter.SimpleDateFormatter" />.
 		/// </para>
 		/// <para>
@@ -308,7 +308,7 @@
 			get { return m_datePattern; }
 			set { m_datePattern = value; }
 		}
-  
+
 		/// <summary>
 		/// Gets or sets the maximum number of backup files that are kept before
 		/// the oldest is erased.
@@ -319,16 +319,16 @@
 		/// </value>
 		/// <remarks>
 		/// <para>
-		/// If set to zero, then there will be no backup files and the log file 
-		/// will be truncated when it reaches <see cref="MaxFileSize"/>.  
+		/// If set to zero, then there will be no backup files and the log file
+		/// will be truncated when it reaches <see cref="MaxFileSize"/>.
 		/// </para>
 		/// <para>
-		/// If a negative number is supplied then no deletions will be made.  Note 
-		/// that this could result in very slow performance as a large number of 
+		/// If a negative number is supplied then no deletions will be made.  Note
+		/// that this could result in very slow performance as a large number of
 		/// files are rolled over unless <see cref="CountDirection"/> is used.
 		/// </para>
 		/// <para>
-		/// The maximum applies to <b>each</b> time based group of files and 
+		/// The maximum applies to <b>each</b> time based group of files and
 		/// <b>not</b> the total.
 		/// </para>
 		/// </remarks>
@@ -337,20 +337,20 @@
 			get { return m_maxSizeRollBackups; }
 			set { m_maxSizeRollBackups = value; }
 		}
-  
+
 		/// <summary>
 		/// Gets or sets the maximum size that the output file is allowed to reach
 		/// before being rolled over to backup files.
 		/// </summary>
 		/// <value>
-		/// The maximum size in bytes that the output file is allowed to reach before being 
+		/// The maximum size in bytes that the output file is allowed to reach before being
 		/// rolled over to backup files.
 		/// </value>
 		/// <remarks>
 		/// <para>
 		/// This property is equivalent to <see cref="MaximumFileSize"/> except
 		/// that it is required for differentiating the setter taking a
-		/// <see cref="long"/> argument from the setter taking a <see cref="string"/> 
+		/// <see cref="long"/> argument from the setter taking a <see cref="string"/>
 		/// argument.
 		/// </para>
 		/// <para>
@@ -362,20 +362,20 @@
 			get { return m_maxFileSize; }
 			set { m_maxFileSize = value; }
 		}
-  
+
 		/// <summary>
 		/// Gets or sets the maximum size that the output file is allowed to reach
 		/// before being rolled over to backup files.
 		/// </summary>
 		/// <value>
-		/// The maximum size that the output file is allowed to reach before being 
+		/// The maximum size that the output file is allowed to reach before being
 		/// rolled over to backup files.
 		/// </value>
 		/// <remarks>
 		/// <para>
 		/// This property allows you to specify the maximum size with the
-		/// suffixes "KB", "MB" or "GB" so that the size is interpreted being 
-		/// expressed respectively in kilobytes, megabytes or gigabytes. 
+		/// suffixes "KB", "MB" or "GB" so that the size is interpreted being
+		/// expressed respectively in kilobytes, megabytes or gigabytes.
 		/// </para>
 		/// <para>
 		/// For example, the value "10KB" will be interpreted as 10240 bytes.
@@ -396,7 +396,7 @@
 		}
 
 		/// <summary>
-		/// Gets or sets the rolling file count direction. 
+		/// Gets or sets the rolling file count direction.
 		/// </summary>
 		/// <value>
 		/// The rolling file count direction.
@@ -413,7 +413,7 @@
 		/// <para>
 		/// <see cref="CountDirection" /> &gt;= 0 does the opposite i.e.
 		/// log.1 is the first backup made, log.5 is the 5th backup made, etc.
-		/// For infinite backups use <see cref="CountDirection" /> &gt;= 0 to reduce 
+		/// For infinite backups use <see cref="CountDirection" /> &gt;= 0 to reduce
 		/// rollover costs.
 		/// </para>
 		/// <para>The default file count direction is -1.</para>
@@ -423,7 +423,7 @@
 			get { return m_countDirection; }
 			set { m_countDirection = value; }
 		}
-  
+
 		/// <summary>
 		/// Gets or sets the rolling style.
 		/// </summary>
@@ -445,7 +445,7 @@
 			set
 			{
 				m_rollingStyle = value;
-				switch (m_rollingStyle) 
+				switch (m_rollingStyle)
 				{
 					case RollingMode.Once:
 						m_rollDate = false;
@@ -467,30 +467,30 @@
 					case RollingMode.Composite:
 						m_rollDate = true;
 						m_rollSize = true;
-						break;	  
+						break;
 				}
 			}
 		}
 
-        /// <summary>
-        /// Gets or sets a value indicating whether to preserve the file name extension when rolling.
-        /// </summary>
-        /// <value>
-        /// <c>true</c> if the file name extension should be preserved.
-        /// </value>
-        /// <remarks>
-        /// <para>
-        /// By default file.log is rolled to file.log.yyyy-MM-dd or file.log.curSizeRollBackup.
-        /// However, under Windows the new file name will loose any program associations as the
-        /// extension is changed. Optionally file.log can be renamed to file.yyyy-MM-dd.log or
-        /// file.curSizeRollBackup.log to maintain any program associations.
-        /// </para>
-        /// </remarks>
-        public bool PreserveLogFileNameExtension
-        {
-            get { return m_preserveLogFileNameExtension; }
-            set { m_preserveLogFileNameExtension = value; }
-        }
+		/// <summary>
+		/// Gets or sets a value indicating whether to preserve the file name extension when rolling.
+		/// </summary>
+		/// <value>
+		/// <c>true</c> if the file name extension should be preserved.
+		/// </value>
+		/// <remarks>
+		/// <para>
+		/// By default file.log is rolled to file.log.yyyy-MM-dd or file.log.curSizeRollBackup.
+		/// However, under Windows the new file name will loose any program associations as the
+		/// extension is changed. Optionally file.log can be renamed to file.yyyy-MM-dd.log or
+		/// file.curSizeRollBackup.log to maintain any program associations.
+		/// </para>
+		/// </remarks>
+		public bool PreserveLogFileNameExtension
+		{
+			get { return m_preserveLogFileNameExtension; }
+			set { m_preserveLogFileNameExtension = value; }
+		}
 
 		/// <summary>
 		/// Gets or sets a value indicating whether to always log to
@@ -507,7 +507,7 @@
 		/// file.log.yyyy-mm-dd.curSizeRollBackup).
 		/// </para>
 		/// <para>
-		/// This will make time based rollovers with a large number of backups 
+		/// This will make time based rollovers with a large number of backups
 		/// much faster as the appender it won't have to rename all the backups!
 		/// </para>
 		/// </remarks>
@@ -519,21 +519,21 @@
 
 		#endregion Public Instance Properties
 
-	    #region Private Static Fields
+		#region Private Static Fields
 
-	    /// <summary>
-	    /// The fully qualified type of the RollingFileAppender class.
-	    /// </summary>
-	    /// <remarks>
-	    /// Used by the internal logger to record the Type of the
-	    /// log message.
-	    /// </remarks>
-	    private readonly static Type declaringType = typeof(RollingFileAppender);
+		/// <summary>
+		/// The fully qualified type of the RollingFileAppender class.
+		/// </summary>
+		/// <remarks>
+		/// Used by the internal logger to record the Type of the
+		/// log message.
+		/// </remarks>
+		private readonly static Type declaringType = typeof(RollingFileAppender);
 
-	    #endregion Private Static Fields
+		#endregion Private Static Fields
 
-		#region Override implementation of FileAppender 
-  
+		#region Override implementation of FileAppender
+
 		/// <summary>
 		/// Sets the quiet writer being used.
 		/// </summary>
@@ -541,7 +541,7 @@
 		/// This method can be overridden by sub classes.
 		/// </remarks>
 		/// <param name="writer">the writer to set</param>
-		override protected void SetQWForFiles(TextWriter writer) 
+		override protected void SetQWForFiles(TextWriter writer)
 		{
 			QuietWriter = new CountingQuietTextWriter(writer, ErrorHandler);
 		}
@@ -557,12 +557,12 @@
 		/// is need and then appends to the file last.
 		/// </para>
 		/// </remarks>
-		override protected void Append(LoggingEvent loggingEvent) 
+		override protected void Append(LoggingEvent loggingEvent)
 		{
 			AdjustFileBeforeAppend();
 			base.Append(loggingEvent);
 		}
-  
+
  		/// <summary>
 		/// Write out an array of logging events.
 		/// </summary>
@@ -574,7 +574,7 @@
 		/// is need and then appends to the file last.
 		/// </para>
 		/// </remarks>
-		override protected void Append(LoggingEvent[] loggingEvents) 
+		override protected void Append(LoggingEvent[] loggingEvents)
 		{
 			AdjustFileBeforeAppend();
 			base.Append(loggingEvents);
@@ -592,21 +592,21 @@
 		/// </remarks>
 		virtual protected void AdjustFileBeforeAppend()
 		{
-			if (m_rollDate) 
+			if (m_rollDate)
 			{
 				DateTime n = m_dateTime.Now;
-				if (n >= m_nextCheck) 
+				if (n >= m_nextCheck)
 				{
 					m_now = n;
 					m_nextCheck = NextCheckDate(m_now, m_rollPoint);
-	
+
 					RollOverTime(true);
 				}
 			}
-	
-			if (m_rollSize) 
+
+			if (m_rollSize)
 			{
-				if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize) 
+				if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
 				{
 					RollOverSize();
 				}
@@ -631,7 +631,7 @@
 
 				// Calculate the current size of the file
 				long currentCount = 0;
-				if (append) 
+				if (append)
 				{
 					using(SecurityContext.Impersonate(this))
 					{
@@ -656,7 +656,7 @@
 					}
 				}
 
-				if (!m_staticLogFileName) 
+				if (!m_staticLogFileName)
 				{
 					m_scheduledFilename = fileName;
 				}
@@ -676,25 +676,25 @@
 		/// <returns>the output file name</returns>
 		/// <remarks>
 		/// The output file name is based on the base fileName specified.
-		/// If <see cref="StaticLogFileName"/> is set then the output 
+		/// If <see cref="StaticLogFileName"/> is set then the output
 		/// file name is the same as the base file passed in. Otherwise
 		/// the output file depends on the date pattern, on the count
 		/// direction or both.
 		/// </remarks>
 		protected string GetNextOutputFileName(string fileName)
 		{
-			if (!m_staticLogFileName) 
+			if (!m_staticLogFileName)
 			{
 				fileName = fileName.Trim();
 
 				if (m_rollDate)
 				{
-                    fileName = CombinePath(fileName, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
+					fileName = CombinePath(fileName, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
 				}
 
-				if (m_countDirection >= 0) 
+				if (m_countDirection >= 0)
 				{
-                    fileName = CombinePath(fileName, "." + m_curSizeRollBackups);
+					fileName = CombinePath(fileName, "." + m_curSizeRollBackups);
 				}
 			}
 
@@ -711,7 +711,7 @@
 		private void DetermineCurSizeRollBackups()
 		{
 			m_curSizeRollBackups = 0;
-	
+
 			string fullPath = null;
 			string fileName = null;
 
@@ -735,14 +735,14 @@
 		/// <returns></returns>
 		private string GetWildcardPatternForFile(string baseFileName)
 		{
-            if (m_preserveLogFileNameExtension)
-            {
-                return Path.GetFileNameWithoutExtension(baseFileName) + ".*" + Path.GetExtension(baseFileName);
-            }
-            else
-            {
-                return baseFileName + '*';
-            }
+			if (m_preserveLogFileNameExtension)
+			{
+				return Path.GetFileNameWithoutExtension(baseFileName) + ".*" + Path.GetExtension(baseFileName);
+			}
+			else
+			{
+				return baseFileName + '*';
+			}
 		}
 
 		/// <summary>
@@ -767,10 +767,10 @@
 					string baseFileName = Path.GetFileName(fullPath);
 
 					string[] files = Directory.GetFiles(directory, GetWildcardPatternForFile(baseFileName));
-	
+
 					if (files != null)
 					{
-						for (int i = 0; i < files.Length; i++) 
+						for (int i = 0; i < files.Length; i++)
 						{
 							string curFileName = Path.GetFileName(files[i]);
 							if (curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFileName)))
@@ -790,14 +790,15 @@
 		/// </summary>
 		private void RollOverIfDateBoundaryCrossing()
 		{
-			if (m_staticLogFileName && m_rollDate) 
+			if (m_staticLogFileName && m_rollDate)
 			{
-				if (FileExists(m_baseFileName)) 
+				if (FileExists(m_baseFileName))
 				{
 					DateTime last;
-					using(SecurityContext.Impersonate(this)) {
+					using(SecurityContext.Impersonate(this))
+					{
 #if !NET_1_0 && !CLI_1_0 && !NETCF
-                        if (DateTimeStrategy is UniversalDateTime)
+						if (DateTimeStrategy is UniversalDateTime)
 						{
 							last = System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
 						}
@@ -806,12 +807,12 @@
 #endif
 							last = System.IO.File.GetLastWriteTime(m_baseFileName);
 #if !NET_1_0 && !CLI_1_0 && !NETCF
-                        }
+						}
 #endif
-                    }
+					}
 					LogLog.Debug(declaringType, "["+last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"] vs. ["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"]");
 
-					if (!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo)))) 
+					if (!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo))))
 					{
 						m_scheduledFilename = m_baseFileName + last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
 						LogLog.Debug(declaringType, "Initial roll over to ["+m_scheduledFilename+"]");
@@ -835,7 +836,7 @@
 		///	</list>
 		///	</para>
 		/// </remarks>
-		protected void ExistingInit() 
+		protected void ExistingInit()
 		{
 			DetermineCurSizeRollBackups();
 			RollOverIfDateBoundaryCrossing();
@@ -878,29 +879,29 @@
 		/// <param name="curFileName"></param>
 		private void InitializeFromOneFile(string baseFile, string curFileName)
 		{
-            if (curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)) == false)
+			if (! curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)))
 			{
 				// This is not a log file, so ignore
 				return;
 			}
-			if (curFileName.Equals(baseFile)) 
+			if (curFileName.Equals(baseFile))
 			{
 				// Base log file is not an incremented logfile (.1 or .2, etc)
 				return;
 			}
-	
-            /*
-			if (m_staticLogFileName) 
+
+			/*
+			if (m_staticLogFileName)
 			{
 				int endLength = curFileName.Length - index;
-				if (baseFile.Length + endLength != curFileName.Length) 
+				if (baseFile.Length + endLength != curFileName.Length)
 				{
 					// file is probably scheduledFilename + .x so I don't care
 					return;
 				}
 			}
-            */
-	
+			*/
+
 			// Only look for files in the current roll point
 			if (m_rollDate && !m_staticLogFileName)
 			{
@@ -910,48 +911,48 @@
 					return;
 				}
 			}
-            
-			try 
+
+			try
 			{
 				// Bump the counter up to the highest count seen so far
-                int backup = GetBackUpIndex(curFileName);
-                
-                // caution: we might get a false positive when certain
-                // date patterns such as yyyyMMdd are used...those are
-                // valid number but aren't the kind of back up index
-                // we're looking for
-                if (backup > m_curSizeRollBackups)
-                {
-                    if (0 == m_maxSizeRollBackups)
-                    {
-                        // Stay at zero when zero backups are desired
-                    }
-                    else if (-1 == m_maxSizeRollBackups)
-                    {
-                        // Infinite backups, so go as high as the highest value
-                        m_curSizeRollBackups = backup;
-                    }
-                    else
-                    {
-                        // Backups limited to a finite number
-                        if (m_countDirection >= 0)
-                        {
-                            // Go with the highest file when counting up
-                            m_curSizeRollBackups = backup;
-                        }
-                        else
-                        {
-                            // Clip to the limit when counting down
-                            if (backup <= m_maxSizeRollBackups)
-                            {
-                                m_curSizeRollBackups = backup;
-                            }
-                        }
-                    }
-                    LogLog.Debug(declaringType, "File name [" + curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
-                }
-			} 
-			catch(FormatException) 
+				int backup = GetBackUpIndex(curFileName);
+
+				// caution: we might get a false positive when certain
+				// date patterns such as yyyyMMdd are used...those are
+				// valid number but aren't the kind of back up index
+				// we're looking for
+				if (backup > m_curSizeRollBackups)
+				{
+					if (0 == m_maxSizeRollBackups)
+					{
+						// Stay at zero when zero backups are desired
+					}
+					else if (-1 == m_maxSizeRollBackups)
+					{
+						// Infinite backups, so go as high as the highest value
+						m_curSizeRollBackups = backup;
+					}
+					else
+					{
+						// Backups limited to a finite number
+						if (m_countDirection >= 0)
+						{
+							// Go with the highest file when counting up
+							m_curSizeRollBackups = backup;
+						}
+						else
+						{
+							// Clip to the limit when counting down
+							if (backup <= m_maxSizeRollBackups)
+							{
+								m_curSizeRollBackups = backup;
+							}
+						}
+					}
+					LogLog.Debug(declaringType, "File name [" + curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
+				}
+			}
+			catch(FormatException)
 			{
 				//this happens when file.log -> file.log.yyyy-MM-dd which is normal
 				//when staticLogFileName == false
@@ -959,38 +960,38 @@
 			}
 		}
 
-        /// <summary>
-        /// Attempts to extract a number from the end of the file name that indicates
-        /// the number of the times the file has been rolled over.
-        /// </summary>
-        /// <remarks>
-        /// Certain date pattern extensions like yyyyMMdd will be parsed as valid backup indexes.
-        /// </remarks>
-        /// <param name="curFileName"></param>
-        /// <returns></returns>
-	    private int GetBackUpIndex(string curFileName)
-	    {
-            int backUpIndex = -1;
-            string fileName = curFileName;
+		/// <summary>
+		/// Attempts to extract a number from the end of the file name that indicates
+		/// the number of the times the file has been rolled over.
+		/// </summary>
+		/// <remarks>
+		/// Certain date pattern extensions like yyyyMMdd will be parsed as valid backup indexes.
+		/// </remarks>
+		/// <param name="curFileName"></param>
+		/// <returns></returns>
+		private int GetBackUpIndex(string curFileName)
+		{
+			int backUpIndex = -1;
+			string fileName = curFileName;
 
-            if (m_preserveLogFileNameExtension)
-            {
-                fileName = Path.GetFileNameWithoutExtension(fileName);
-            }
-            
-            int index = fileName.LastIndexOf(".");
-            if (index > 0)
-            {
-                // 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
-                SystemInfo.TryParse(fileName.Substring(index + 1), out backUpIndex);
-            }
+			if (m_preserveLogFileNameExtension)
+			{
+				fileName = Path.GetFileNameWithoutExtension(fileName);
+			}
 
-            return backUpIndex;
-	    }
+			int index = fileName.LastIndexOf(".");
+			if (index > 0)
+			{
+				// 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
+				SystemInfo.TryParse(fileName.Substring(index + 1), out backUpIndex);
+			}
 
-	    /// <summary>
-		/// Takes a list of files and a base file name, and looks for 
+			return backUpIndex;
+		}
+
+		/// <summary>
+		/// Takes a list of files and a base file name, and looks for
 		/// 'incremented' versions of the base file.  Bumps the max
 		/// count up to the highest count seen.
 		/// </summary>
@@ -1018,13 +1019,13 @@
 		/// Essentially the date pattern is examined to determine what the
 		/// most suitable roll point is. The roll point chosen is the roll point
 		/// with the smallest period that can be detected using the date pattern
-		/// supplied. i.e. if the date pattern only outputs the year, month, day 
+		/// supplied. i.e. if the date pattern only outputs the year, month, day
 		/// and hour then the smallest roll point that can be detected would be
 		/// and hourly roll point as minutes could not be detected.
 		/// </remarks>
-		private RollPoint ComputeCheckPeriod(string datePattern) 
+		private RollPoint ComputeCheckPeriod(string datePattern)
 		{
-			// s_date1970 is 1970-01-01 00:00:00 this is UniversalSortableDateTimePattern 
+			// s_date1970 is 1970-01-01 00:00:00 this is UniversalSortableDateTimePattern
 			// (based on ISO 8601) using universal time. This date is used for reference
 			// purposes to calculate the resolution of the date pattern.
 
@@ -1032,7 +1033,7 @@
 			string r0 = s_date1970.ToString(datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
 
 			// Check each type of rolling mode starting with the smallest increment.
-			for(int i = (int)RollPoint.TopOfMinute; i <= (int)RollPoint.TopOfMonth; i++) 
+			for(int i = (int)RollPoint.TopOfMinute; i <= (int)RollPoint.TopOfMonth; i++)
 			{
 				// Get string representation of next pattern
 				string r1 = NextCheckDate(s_date1970, (RollPoint)i).ToString(datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
@@ -1040,7 +1041,7 @@
 				LogLog.Debug(declaringType, "Type = ["+i+"], r0 = ["+r0+"], r1 = ["+r1+"]");
 
 				// Check if the string representations are different
-				if (r0 != null && r1 != null && !r0.Equals(r1)) 
+				if (r0 != null && r1 != null && !r0.Equals(r1))
 				{
 					// Found highest precision roll point
 					return (RollPoint)i;
@@ -1056,13 +1057,13 @@
 		/// <remarks>
 		/// <para>
 		/// This is part of the <see cref="IOptionHandler"/> delayed object
-		/// activation scheme. The <see cref="ActivateOptions"/> method must 
+		/// activation scheme. The <see cref="ActivateOptions"/> method must
 		/// be called on this object after the configuration properties have
 		/// been set. Until <see cref="ActivateOptions"/> is called this
-		/// object is in an undefined state and must not be used. 
+		/// object is in an undefined state and must not be used.
 		/// </para>
 		/// <para>
-		/// If any of the configuration properties are modified then 
+		/// If any of the configuration properties are modified then
 		/// <see cref="ActivateOptions"/> must be called again.
 		/// </para>
 		/// <para>
@@ -1071,14 +1072,14 @@
 		/// the current number of backups.
 		/// </para>
 		/// </remarks>
-		override public void ActivateOptions() 
+		override public void ActivateOptions()
 		{
 			if (m_dateTime == null)
 			{
 				m_dateTime = new LocalDateTime();
 			}
 
-			if (m_rollDate && m_datePattern != null) 
+			if (m_rollDate && m_datePattern != null)
 			{
 				m_now = m_dateTime.Now;
 				m_rollPoint = ComputeCheckPeriod(m_datePattern);
@@ -1090,8 +1091,8 @@
 
 				// next line added as this removes the name check in rollOver
 				m_nextCheck = NextCheckDate(m_now, m_rollPoint);
-			} 
-			else 
+			}
+			else
 			{
 				if (m_rollDate)
 				{
@@ -1117,36 +1118,36 @@
 
 			if (m_rollDate && File != null && m_scheduledFilename == null)
 			{
-                m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
+				m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
 			}
 
 			ExistingInit();
-	
+
 			base.ActivateOptions();
 		}
 
 		#endregion
-  
+
 		#region Roll File
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="path1"></param>
-        /// <param name="path2">.1, .2, .3, etc.</param>
-        /// <returns></returns>
-        private string CombinePath(string path1, string path2)
-        {
-            string extension = Path.GetExtension(path1);
-            if (m_preserveLogFileNameExtension && extension.Length > 0)
-            {
-                return Path.Combine(Path.GetDirectoryName(path1), Path.GetFileNameWithoutExtension(path1) + path2 + extension);
-            }
-            else
-            {
-                return path1 + path2;
-            }
-        }
+		/// <summary>
+		///
+		/// </summary>
+		/// <param name="path1"></param>
+		/// <param name="path2">.1, .2, .3, etc.</param>
+		/// <returns></returns>
+		private string CombinePath(string path1, string path2)
+		{
+			string extension = Path.GetExtension(path1);
+			if (m_preserveLogFileNameExtension && extension.Length > 0)
+			{
+				return Path.Combine(Path.GetDirectoryName(path1), Path.GetFileNameWithoutExtension(path1) + path2 + extension);
+			}
+			else
+			{
+				return path1 + path2;
+			}
+		}
 
 		/// <summary>
 		/// Rollover the file(s) to date/time tagged file(s).
@@ -1155,53 +1156,53 @@
 		/// <remarks>
 		/// <para>
 		/// Rollover the file(s) to date/time tagged file(s).
-		/// Resets curSizeRollBackups. 
+		/// Resets curSizeRollBackups.
 		/// If fileIsOpen is set then the new file is opened (through SafeOpenFile).
 		/// </para>
 		/// </remarks>
-		protected void RollOverTime(bool fileIsOpen) 
+		protected void RollOverTime(bool fileIsOpen)
 		{
-			if (m_staticLogFileName) 
+			if (m_staticLogFileName)
 			{
 				// Compute filename, but only if datePattern is specified
-				if (m_datePattern == null) 
+				if (m_datePattern == null)
 				{
 					ErrorHandler.Error("Missing DatePattern option in rollOver().");
 					return;
 				}
-	  
+
 				//is the new file name equivalent to the 'current' one
 				//something has gone wrong if we hit this -- we should only
 				//roll over if the new file will be different from the old
 				string dateFormat = m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo);
-                if (m_scheduledFilename.Equals(CombinePath(File, dateFormat))) 
+				if (m_scheduledFilename.Equals(CombinePath(File, dateFormat)))
 				{
-                    ErrorHandler.Error("Compare " + m_scheduledFilename + " : " + CombinePath(File, dateFormat));
+					ErrorHandler.Error("Compare " + m_scheduledFilename + " : " + CombinePath(File, dateFormat));
 					return;
 				}
-	  
+
 				if (fileIsOpen)
 				{
 					// close current file, and rename it to datedFilename
 					this.CloseFile();
 				}
-	  
+
 				//we may have to roll over a large number of backups here
-				for (int i = 1; i <= m_curSizeRollBackups; i++) 
+				for (int i = 1; i <= m_curSizeRollBackups; i++)
 				{
-                    string from = CombinePath(File, "." + i);
-                    string to = CombinePath(m_scheduledFilename, "." + i);
+					string from = CombinePath(File, "." + i);
+					string to = CombinePath(m_scheduledFilename, "." + i);
 					RollFile(from, to);
 				}
-	  
+
 				RollFile(File, m_scheduledFilename);
 			}
-	
+
 			//We've cleared out the old date and are ready for the new
-			m_curSizeRollBackups = 0; 
-	
+			m_curSizeRollBackups = 0;
+
 			//new scheduled name
-            m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
+			m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo));
 
 			if (fileIsOpen)
 			{
@@ -1209,7 +1210,7 @@
 				SafeOpenFile(m_baseFileName, false);
 			}
 		}
-  
+
 		/// <summary>
 		/// Renames file <paramref name="fromFile"/> to file <paramref name="toFile"/>.
 		/// </summary>
@@ -1221,7 +1222,7 @@
 		/// also checks for existence of target file and deletes if it does.
 		/// </para>
 		/// </remarks>
-		protected void RollFile(string fromFile, string toFile) 
+		protected void RollFile(string fromFile, string toFile)
 		{
 			if (FileExists(fromFile))
 			{
@@ -1265,7 +1266,7 @@
 				return System.IO.File.Exists(path);
 			}
 		}
-  
+
 		/// <summary>
 		/// Deletes the specified file if it exists.
 		/// </summary>
@@ -1278,9 +1279,9 @@
 		/// be deleted, but it still can be moved.
 		/// </para>
 		/// </remarks>
-		protected void DeleteFile(string fileName) 
+		protected void DeleteFile(string fileName)
 		{
-			if (FileExists(fileName)) 
+			if (FileExists(fileName))
 			{
 				// We may not have permission to delete the file, or the file may be locked
 
@@ -1327,7 +1328,7 @@
 				}
 			}
 		}
-  
+
 		/// <summary>
 		/// Implements file roll base on file size.
 		/// </summary>
@@ -1354,18 +1355,18 @@
 		/// renamed if needed and no files are deleted.
 		/// </para>
 		/// </remarks>
-		protected void RollOverSize() 
+		protected void RollOverSize()
 		{
 			this.CloseFile(); // keep windows happy.
-	
+
 			LogLog.Debug(declaringType, "rolling over count ["+((CountingQuietTextWriter)QuietWriter).Count+"]");
 			LogLog.Debug(declaringType, "maxSizeRollBackups ["+m_maxSizeRollBackups+"]");
 			LogLog.Debug(declaringType, "curSizeRollBackups ["+m_curSizeRollBackups+"]");
 			LogLog.Debug(declaringType, "countDirection ["+m_countDirection+"]");
 
 			RollOverRenameFiles(File);
-	
-			if (!m_staticLogFileName && m_countDirection >= 0) 
+
+			if (!m_staticLogFileName && m_countDirection >= 0)
 			{
 				m_curSizeRollBackups++;
 			}
@@ -1386,7 +1387,7 @@
 		/// If <c>countDirection</c> &lt; 0, then files
 		/// {<c>File.1</c>, ..., <c>File.curSizeRollBackups -1</c>}
 		/// are renamed to {<c>File.2</c>, ...,
-		/// <c>File.curSizeRollBackups</c>}. 
+		/// <c>File.curSizeRollBackups</c>}.
 		/// </para>
 		/// <para>
 		/// If <c>maxSizeRollBackups</c> is equal to zero, then the
@@ -1400,35 +1401,35 @@
 		/// This is called by <see cref="RollOverSize"/> to rename the files.
 		/// </para>
 		/// </remarks>
-		protected void RollOverRenameFiles(string baseFileName) 
+		protected void RollOverRenameFiles(string baseFileName)
 		{
 			// If maxBackups <= 0, then there is no file renaming to be done.
-			if (m_maxSizeRollBackups != 0) 
+			if (m_maxSizeRollBackups != 0)
 			{
-				if (m_countDirection < 0) 
+				if (m_countDirection < 0)
 				{
 					// Delete the oldest file, to keep Windows happy.
-					if (m_curSizeRollBackups == m_maxSizeRollBackups) 
+					if (m_curSizeRollBackups == m_maxSizeRollBackups)
 					{
-                        DeleteFile(CombinePath(baseFileName, "." + m_maxSizeRollBackups));
+						DeleteFile(CombinePath(baseFileName, "." + m_maxSizeRollBackups));
 						m_curSizeRollBackups--;
 					}
-	
+
 					// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
-					for (int i = m_curSizeRollBackups; i >= 1; i--) 
+					for (int i = m_curSizeRollBackups; i >= 1; i--)
 					{
-                        RollFile((CombinePath(baseFileName, "." + i)), (CombinePath(baseFileName, "." + (i + 1))));
+						RollFile((CombinePath(baseFileName, "." + i)), (CombinePath(baseFileName, "." + (i + 1))));
 					}
-	
+
 					m_curSizeRollBackups++;
 
 					// Rename fileName to fileName.1
-                    RollFile(baseFileName, CombinePath(baseFileName, ".1"));
-				} 
-				else 
+					RollFile(baseFileName, CombinePath(baseFileName, ".1"));
+				}
+				else
 				{
 					//countDirection >= 0
-					if (m_curSizeRollBackups >= m_maxSizeRollBackups && m_maxSizeRollBackups > 0) 
+					if (m_curSizeRollBackups >= m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
 					{
 						//delete the first and keep counting up.
 						int oldestFileIndex = m_curSizeRollBackups - m_maxSizeRollBackups;
@@ -1446,20 +1447,20 @@
 						if (!m_staticLogFileName)
 						{
 							int lastDotIndex = archiveFileBaseName.LastIndexOf(".");
-							if (lastDotIndex >= 0) 
+							if (lastDotIndex >= 0)
 							{
 								archiveFileBaseName = archiveFileBaseName.Substring(0, lastDotIndex);
 							}
 						}
 
 						// Delete the archive file
-                        DeleteFile(CombinePath(archiveFileBaseName, "." + oldestFileIndex));
+						DeleteFile(CombinePath(archiveFileBaseName, "." + oldestFileIndex));
 					}
-	
-					if (m_staticLogFileName) 
+
+					if (m_staticLogFileName)
 					{
 						m_curSizeRollBackups++;
-                        RollFile(baseFileName, CombinePath(baseFileName, "." + m_curSizeRollBackups));
+						RollFile(baseFileName, CombinePath(baseFileName, "." + m_curSizeRollBackups));
 					}
 				}
 			}
@@ -1486,13 +1487,13 @@
 		/// worth of time and get the start time of the next window for the rollpoint.
 		/// </para>
 		/// </remarks>
-		protected DateTime NextCheckDate(DateTime currentDateTime, RollPoint rollPoint) 
+		protected DateTime NextCheckDate(DateTime currentDateTime, RollPoint rollPoint)
 		{
 			// Local variable to work on (this does not look very efficient)
 			DateTime current = currentDateTime;
 
 			// Do slightly different things depending on what the type of roll point we want.
-			switch(rollPoint) 
+			switch(rollPoint)
 			{
 				case RollPoint.TopOfMinute:
 					current = current.AddMilliseconds(-current.Millisecond);
@@ -1512,11 +1513,11 @@
 					current = current.AddSeconds(-current.Second);
 					current = current.AddMinutes(-current.Minute);
 
-					if (current.Hour < 12) 
+					if (current.Hour < 12)
 					{
 						current = current.AddHours(12 - current.Hour);
-					} 
-					else 
+					}
+					else
 					{
 						current = current.AddHours(-current.Hour);
 						current = current.AddDays(1);
@@ -1547,7 +1548,7 @@
 					current = current.AddDays(1 - current.Day); /* first day of month is 1 not 0 */
 					current = current.AddMonths(1);
 					break;
-			}	  
+			}
 			return current;
 		}
 
@@ -1563,38 +1564,38 @@
 		private IDateTime m_dateTime = null;
 
 		/// <summary>
-		/// The date pattern. By default, the pattern is set to <c>".yyyy-MM-dd"</c> 
+		/// The date pattern. By default, the pattern is set to <c>".yyyy-MM-dd"</c>
 		/// meaning daily rollover.
 		/// </summary>
 		private string m_datePattern = ".yyyy-MM-dd";
-  
+
 		/// <summary>
 		/// The actual formatted filename that is currently being written to
 		/// or will be the file transferred to on roll over
 		/// (based on staticLogFileName).
 		/// </summary>
 		private string m_scheduledFilename = null;
-  
+
 		/// <summary>
 		/// The timestamp when we shall next recompute the filename.
 		/// </summary>
 		private DateTime m_nextCheck = DateTime.MaxValue;
-  
+
 		/// <summary>
 		/// Holds date of last roll over
 		/// </summary>
 		private DateTime m_now;
-  
+
 		/// <summary>
 		/// The type of rolling done
 		/// </summary>
 		private RollPoint m_rollPoint;
-  
+
 		/// <summary>
 		/// The default maximum file size is 10MB
 		/// </summary>
 		private long m_maxFileSize = 10*1024*1024;
-  
+
 		/// <summary>
 		/// There is zero backup files by default
 		/// </summary>
@@ -1604,12 +1605,12 @@
 		/// How many sized based backups have been made so far
 		/// </summary>
 		private int m_curSizeRollBackups = 0;
-  
+
 		/// <summary>
-		/// The rolling file count direction. 
+		/// The rolling file count direction.
 		/// </summary>
 		private int m_countDirection = -1;
-  
+
 		/// <summary>
 		/// The rolling mode used in this appender.
 		/// </summary>
@@ -1624,13 +1625,13 @@
 		/// Cache flag set if we are rolling by size.
 		/// </summary>
 		private bool m_rollSize = true;
-  
+
 		/// <summary>
 		/// Value indicating whether to always log to the same file.
 		/// </summary>
 		private bool m_staticLogFileName = true;
-  
-   		/// <summary>
+
+		/// <summary>
 		/// Value indicating whether to preserve the file name extension when rolling.
 		/// </summary>
 		private bool m_preserveLogFileNameExtension = false;
@@ -1640,7 +1641,7 @@
 		/// FileName provided in configuration.  Used for rolling properly
 		/// </summary>
 		private string m_baseFileName;
-  
+
 		#endregion Private Instance Fields
 
 		#region Static Members
@@ -1697,7 +1698,7 @@
 		}
 
 #if !NET_1_0 && !CLI_1_0 && !NETCF
-        /// <summary>
+		/// <summary>
 		/// Implementation of <see cref="IDateTime"/> that returns the current time as the coordinated universal time (UTC).
 		/// </summary>
 		private class UniversalDateTime : IDateTime
@@ -1718,6 +1719,6 @@
 		}
 #endif
 
-        #endregion DateTime
+		#endregion DateTime
 	}
 }