Consider this configuration, with V 1.2.11 or trunk:

<file value="log.log" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value=".yyyyMMdd-HHmm" />
<staticLogFileName value="true" />
<preserveLogFileNameExtension value="true" />

* Start an application (a verbose one, preferably) with it.

* Kill it immediately.
  Log directory now looks like this
  ---
  log.log
  ---

* Wait until we are in another minute

* Start application again

* Kill it immediately
  Log directory now looks like this
  ---
  log.log
  log.log.20130122-2042
  ---

Didn't we say we want to preserveLogFileNameExtension?
Shouldn't the file name of the file rolled over be "log.20130122-2042.log"?
If the application weren't killed and restarted in another period,
everything were correct.

This happens when rolling over an old log file from a previous run upon 
application start. The line of this patch fixes it. Obviously the one who once 
extracted the function CombinePath to always correctly consider the setting of 
preserveLogFileNameExtension simply overlooked this one occurrence of file name 
combining.

AFAIK this hasn't been reported yet.

>
>
> 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+"]");
>

Reply via email to