[logback-user] recreate deleted file

Will Norris will at willnorris.com
Thu Jan 10 17:54:22 CET 2008


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



More information about the Logback-user mailing list