[logback-user] Delete log file

pwillems66 at zonnet.nl pwillems66 at zonnet.nl
Thu Nov 18 17:01:27 CET 2010


Hi,

The prudent propertie doesn't work. Any other idea?
It looks like the log file is in use. Is their a way to
'unlock' that use by code?

This is what I must realize:
For every test I need to create a log file. When the same test start 
again the previous file must be deleted (or renamed and delete 
thereafter) and a new one created. Also (test is not running) it must 
be possible to delete the log file.

-Patrick

pwillems66 at zonnet.nl wrote:
> Maybe someone else have a (different) solution?

FileAppender.setPrudent() looks promising for this purpose.  However, 
using the example from PrudentTimeBasedRolling.xml, when I rm the file 
it is not recreated on the next log statement.  Also, if it did work, 
it doesn't support your file appender, but maybe it is ok to change 
that.

http://logback.qos.ch/codes.html#tbr_fnp_prudent_unsupported says,
> prudent mode is not allowed in conjuction with a FixedWindowRollingPolicy.

-Gordon




More information about the Logback-user mailing list