
File::RotateLogs - File logger supports log rotation

use File::RotateLogs;
use Plack::Builder;
my $rotatelogs = File::RotateLogs->new(
logfile => '/path/to/access_log.%Y%m%d%H%M',
linkname => '/path/to/access_log',
rotationtime => 3600,
maxage => 86400, #1day
);
builder {
enable 'AccessLog',
logger => sub { $rotatelogs->print(@_) };
$app;
};

File::RotateLogs is utility for file logger. Supports logfile rotation and makes symlink to newest logfile.

This is file name pattern. It is the pattern for filename. The format is POSIX::strftime(), see also POSIX.
Filename to symlink to newest logfile. default: none
default: 86400 (1day)
Maximum age of files (based on mtime), in seconds. After the age is surpassed, files older than this age will be deleted. Optional. Default is undefined, which means unlimited. old files are removed at a background unlink worker.
Sleep seconds before remove old log files. default: 3 If sleep_before_remove == 0, files are removed within plack processes. Does not fork background unlink worker.

Masahiro Nagano <kazeburo {at} gmail.com>

File::Stamped, Log::Dispatch::Dir

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.