You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Robert Nicholson <ro...@gmail.com> on 2008/07/16 21:03:20 UTC

DailyRollingAppender doing strange things with log4j-1.2.14

I'm noticying right now the following situation


-rw-r--r--  1  311170 Jul 16 14:00 name.log

-rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15

 What you should see is that today's log is actively overwriting yesterday's
rolled log.

So yesterdays log is history as it's been overwritten.

Can anybody explain this behaviour and whether a newer version corrects this
problem?

Re: DailyRollingAppender doing strange things with log4j-1.2.14

Posted by Robert Nicholson <ro...@gmail.com>.
That isn't the case. In so far as there aren't two instances of  
DailyRollingFileAppender writing to the same location. That said the  
application is multithreaded but that all should be synchronized.

On Jul 17, 2008, at 1:00 AM, Curt Arnold wrote:

>
> On Jul 16, 2008, at 2:03 PM, Robert Nicholson wrote:
>
>> I'm noticying right now the following situation
>>
>>
>> -rw-r--r--  1  311170 Jul 16 14:00 name.log
>>
>> -rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15
>>
>> What you should see is that today's log is actively overwriting  
>> yesterday's
>> rolled log.
>>
>> So yesterdays log is history as it's been overwritten.
>>
>> Can anybody explain this behaviour and whether a newer version  
>> corrects this
>> problem?
>
> Very common and expected behavior if you have two instances of  
> DailyRollingFileAppender writing to the same location on a Unix.   
> One instances renames the current file and creates a new file, when  
> the second instance attempts to roll, it cannot create the new file  
> and continues writing to the "old" file, but now renamed file.  The  
> moral is not not allow two instances of DailyRollingFileAppender to  
> contend for the same file names.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DailyRollingAppender doing strange things with log4j-1.2.14

Posted by Curt Arnold <ca...@apache.org>.
On Jul 16, 2008, at 2:03 PM, Robert Nicholson wrote:

> I'm noticying right now the following situation
>
>
> -rw-r--r--  1  311170 Jul 16 14:00 name.log
>
> -rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15
>
> What you should see is that today's log is actively overwriting  
> yesterday's
> rolled log.
>
> So yesterdays log is history as it's been overwritten.
>
> Can anybody explain this behaviour and whether a newer version  
> corrects this
> problem?

Very common and expected behavior if you have two instances of  
DailyRollingFileAppender writing to the same location on a Unix.  One  
instances renames the current file and creates a new file, when the  
second instance attempts to roll, it cannot create the new file and  
continues writing to the "old" file, but now renamed file.  The moral  
is not not allow two instances of DailyRollingFileAppender to contend  
for the same file names.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DailyRollingAppender doing strange things with log4j-1.2.14

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Robert Nicholson skrev  den 17-07-2008 14:44:
> No, it's like a file descriptor wasn't closed or something because
> all of the 15th's log has been overwritten. ie. that 15'th log starts
> at midnight 16th.
>
> On Jul 16, 2008, at 3:07 PM, Thorbjørn Ravn Andersen wrote:
>
>> Robert Nicholson skrev  den 16-07-2008 21:03:
>>> I'm noticying right now the following situation
>>>
>>>
>>> -rw-r--r--  1  311170 Jul 16 14:00 name.log
>>>
>>> -rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15
>>>
Have you found an explanation for this?  I find it a bit curious that 
there are two "name.log" files being written to on the 16th.

-- 
  Thorbjørn



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DailyRollingAppender doing strange things with log4j-1.2.14

Posted by Robert Nicholson <ro...@gmail.com>.
No, it's like a file descriptor wasn't closed or something because
all of the 15th's log has been overwritten. ie. that 15'th log starts
at midnight 16th.

On Jul 16, 2008, at 3:07 PM, Thorbjørn Ravn Andersen wrote:

> Robert Nicholson skrev  den 16-07-2008 21:03:
>> I'm noticying right now the following situation
>>
>>
>> -rw-r--r--  1  311170 Jul 16 14:00 name.log
>>
>> -rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15
>>
>> What you should see is that today's log is actively overwriting  
>> yesterday's
>> rolled log.
>>
>> So yesterdays log is history as it's been overwritten.
>>
>> Can anybody explain this behaviour and whether a newer version  
>> corrects this
>> problem?
>>
> The rolling does not happen automatically at midnight, but when a  
> logging event has been determined to be in the "next" period.
>
> Are the contents of the logs correct?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DailyRollingAppender doing strange things with log4j-1.2.14

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Robert Nicholson skrev  den 16-07-2008 21:03:
> I'm noticying right now the following situation
>
>
> -rw-r--r--  1  311170 Jul 16 14:00 name.log
>
> -rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15
>
>  What you should see is that today's log is actively overwriting yesterday's
> rolled log.
>
> So yesterdays log is history as it's been overwritten.
>
> Can anybody explain this behaviour and whether a newer version corrects this
> problem?
>   
The rolling does not happen automatically at midnight, but when a 
logging event has been determined to be in the "next" period.

Are the contents of the logs correct?

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org