Overview
Features
Download
Documentation
Community
Add-Ons & Services

Problem using RotateAtTimeStrategy

Please post support and help requests here.

Problem using RotateAtTimeStrategy

Postby gregoire » 06 Jul 2010, 23:31

Hello,

I am using a Logger along with a FileChannel. I want the LogFile to be rotated at midnight (utc) every day.
The PropertyFileConfiguration below does not seem to work, the file is not rotated.
It works well with other rotation stategy, not with the RotateAtTimeStrategy.

Am I messing something up ?

Code: Select all
static const std::string config =
    "logging.loggers.l1.name = detail\n"
    "logging.loggers.l1.channel = detail\n"
    "logging.loggers.l1.level = trace\n"
    "logging.channels.detail.class = FileChannel\n"
    "logging.channels.detail.path = details.log\n"
    "logging.channels.detail.rotation = 00:00\n"
    "logging.channels.detail.archive = timestamp\n"
    "logging.channels.detail.times = utc\n"
    "logging.channels.detail.compress = true\n";
gregoire
 
Posts: 30
Joined: 27 Jan 2009, 19:23
Location: Grenoble, France

Re: Problem using RotateAtTimeStrategy

Postby gregoire » 23 Jul 2010, 22:13

I have found why my file is never rotated.

If I want it to be rotated every day at midnight utc, I write:
Code: Select all
      AutoPtr<FileChannel> pChannel = new FileChannel("myLogFile.log");
      pChannel->setProperty(FileChannel::PROP_TIMES, "utc");
      pChannel->setProperty(FileChannel::PROP_ROTATION, "00:00");


It works well if my App is up at midnight.

But for example, if I launch it at 8:00 and close it at 18:00 every day, it will never be rotated.
The file "myLogFile.log" will grow endlessly because 00:00 is not between 8:00 and 18:00.

Is this a bug ?

If not I cannot use this strategy because I won't be able to control when the App is running. So RotateByIntervalStrategy will be my second choice.
gregoire
 
Posts: 30
Joined: 27 Jan 2009, 19:23
Location: Grenoble, France

Re: Problem using RotateAtTimeStrategy

Postby guenter » 24 Jul 2010, 08:31

An oversight in the implementation maybe. When opening the log file for the first time, we should probably check if we must rotate (e.g., if the rotation time is between the last modification and the current date).
guenter
 
Posts: 1107
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Problem using RotateAtTimeStrategy

Postby Giovani » 06 Jan 2014, 20:01

That modification would be very helpfull.
In my case i had to set rotateOnOpen to true, but its not exactly what i wanted.
Giovani
 
Posts: 5
Joined: 26 Nov 2012, 19:45


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron