Masahiro Nagano > File-RotateLogs-0.01 > File::RotateLogs

Download:
File-RotateLogs-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: File-RotateLogs-0.07

NAME ^

File::RotateLogs - File logger supports log rotation

SYNOPSIS ^

  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;
  };

DESCRIPTION ^

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

CONFIGURATION ^

logfile

This is file name pattern. It is the pattern for filename. The format is POSIX::strftime(), see also POSIX.

linkname

Filename to symlink to newest logfile. default: none

rotationtime

default: 86400 (1day)

maxage

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_before_remove

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.

AUTHOR ^

Masahiro Nagano <kazeburo {at} gmail.com>

SEE ALSO ^

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

LICENSE ^

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

syntax highlighting: