[logback-user] recreate deleted file

Ceki Gulcu listid at qos.ch
Thu Jan 10 18:19:13 CET 2008


Hi Will,

Without referring to any specific appender implementation, what is it that you 
are trying to accomplish.

 From what I understand, you would like process P1 to log instructions to a 
file, say F, and some other process P2 to roll over file F to F1, and then 
handle the instructions contained in F1. In the meanwhile, process P1 continues 
to log into file F. (File F is empty after roll over).

Is the above correct?


Will Norris wrote:
> I had considered that, but there is still one small problem.  I'm using 
> said log file to log actions that need to be performed by another 
> process. At some interval, let's say nightly, this other process will 
> come and grab the already rolled-over files and go process them.  My 
> understanding of the rollover file appender is that even if the rollover 
> interval has passed, it doesn't actually perform the rollover until the 
> next log message.  So if my application goes a couple of days without 
> logging another of these events, the file will never be rolled over and 
> the "other process" will never see it.  I guess I could periodically 
> write a blank message to the file to force it to rollover, but that 
> seems a little kludgy.  *shrug*
> 
> -will
> 
> On Jan 9, 2008, at 10:18 PM, Chad La Joie wrote:
> 
>> Will, one way to get around the issue would be to set the roll over 
>> policy to something small enough that it will rotate the active log in 
>> a manner timely enough for you to move them around as needed.  Not a 
>> fix for the underlying problem, but might hold you over.
>>
>> Will Norris wrote:
>>> Are any of the logback FileAppenders able to recreate their logfile 
>>> if it goes away for whatever reason.  In my testing, if I delete the 
>>> log file or move it to another location, logback doesn't log any 
>>> futher until I restart my application.  I would like for it to 
>>> recreate the file if it is no longer present.  Is that possible?
>>> Thanks,
>>> Will
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the Logback-user mailing list