Johan,

I couldn't find any solution that didn't imply some sort of
reimplementation of the appender to do a (resource wasting) monitoring
on the time and issue the internal roll command.

My ugly workaround hack was simple. The conversion pattern I'm using
with the layout associated to the appender is "%m%n". Thus, logging a
String to this appender will result in exaclty the string getting
printed by itself on a single line. I created a jsp page that logs
"MANUAL ROLLOVER" to the logger, and a cron job to call this jsp with
wget at 00:05 every day. Then the processing script has a sed
one-liner to remove the rollover-inducing lines. Since there's no
variable fields in the conversion pattern, the string is easily
matchable.

It's ugly but it works :)

Cheers,

On 7/24/06, Johan Boer <[EMAIL PROTECTED]> wrote:



Javier,

The question you asked about logfile rotation is one that seems to be asked
from time to time but I haven't found a good answer. If you have found a
acceptable solution for this issue can you let me know?
I am also processing logfiles somewhere after midnight and ran into the same
issue.

It is possible to use
org.apache.log4j.varia.ExternallyRolledFileAppender and
trigger it with a message sent to a port but I it is a ugly work around.

Thanks in advance,
    Johan Boer


 ________________________________

From: Javier Gonzalez <jagonzal <at> gmail.com>
Subject: DailyRollingFileAppender, rolling at midnight
Newsgroups: gmane.comp.jakarta.log4j.user
Date: 2006-07-17 15:51:41 GMT (6 days, 16 hours and 18 minutes ago)
Hi,

I have an app doing traffic records using log4j.

I need daily logs, so I configured a DailyRollingAppender for said records.

However, the log doesn't rotate at midnight, it rotates when it
receives the first message after midnight has passed. Due to some
batch jobs processing the logs run shortly after midnight, I need the
logs to roll at 00:00:00, give or take a few minutes.

Is there a way to configure the DailyRollingAppender for that? I
really don't want to program a log event getting sent to the Logger at
midnight since that would mean creating a bogus record that will
distort the actual logs.

Thanks in advance.

--
Javier González Nicolini




--
Javier González Nicolini

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to