logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Best strategy to ensure a rolling when an application is launched
Date Tue, 19 Jun 2007 04:15:55 GMT

On Jun 18, 2007, at 8:35 AM, Florian Seydoux wrote:

> Hello,
> I'm using log4cxx with a standard application (not supposed to be  
> runned
> continuously), but I want to have two logs, one per day (in order to
> check potential problems returned by the 'users', i.e. probably not
> immediately) , and another per run (with retention of 5~10 runs), for
> debugging purpose.
> Unfortunately, both RollingFileAppender and DailyRollingFileAppender
> can't be used (at least directly), because the application is supposed
> to be running when it's time to roll.
> At your opinion, what is the best way for me to 'force' a test of the
> rolling policy when the application is runned ?
> Should I create my own appender, or there is something that I've  
> missed ?

logcxx::rolling::RollingFileAppender supports user-provided  
TriggeringPolicy's (which determines when a rollover should be  
attempted) and RollingPolicy's (which determine what file names to  
use).  In this case, you could write your own TriggeringPolicy that  
triggers a rollover on application start up or when the application  
rolls over a date change or some other criteria.

View raw message