Rotate log file
Perl
Latest commit 3a7456b Jul 6, 2016 @kazeburo Checking in changes prior to tagging of version 0.08.
Changelog diff is:

diff --git a/Changes b/Changes
index 9159a81..4d82e4f 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@ Revision history for Perl extension File::RotateLogs

 {{$NEXT}}

+0.08 2016-07-06T08:51:14Z
+
+        - add mkdir feature (Thanks masartz)
+
 0.07 2013-11-28T15:19:01Z

         - add warnings when maxage is not configured
Permalink
Failed to load latest commit information.
lib/File Checking in changes prior to tagging of version 0.08. Jul 6, 2016
t create directory if log_file path does not exist Jun 24, 2016
.gitignore minil migrate Jun 4, 2013
.travis.yml test::requries Sep 13, 2013
Build.PL check directory exists Jul 6, 2016
Changes Checking in changes prior to tagging of version 0.08. Jul 6, 2016
LICENSE minil migrate Jun 4, 2013
META.json
README.md check directory exists Jul 6, 2016
cpanfile create directory if log_file path does not exist Jun 24, 2016

README.md

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.

  • offset

    The number of seconds offset form UTC. default: 0 If offset is omitted or set zero, UTC is used. When rotationtime is 24h and offset is 0, log is going to be rotated at 0 O'clock (UTC). For example, to use local timezone in the zone UTC +9 (Asia/Tokyo), set 32400 (9*60*60).

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.