The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::Dispatch::File::Rolling - Object for logging to date/time/pid stamped files

SYNOPSIS

  use Log::Dispatch::File::Rolling;

  my $file = Log::Dispatch::File::Rolling->new(
                             name      => 'file1',
                             min_level => 'info',
                             filename  => 'Somefile%d{yyyyMMdd}.log',
                             mode      => 'append' );

  $file->log( level => 'emerg', message => "I've fallen and I can't get up\n" );

ABSTRACT

This module provides an object for logging to files under the Log::Dispatch::* system.

DESCRIPTION

This module subclasses Log::Dispatch::File for logging to date/time stamped files. See Log::Dispatch::File for instructions on usage. This module differs only on the following three points:

fork()-safe

This module will close and re-open the logfile after a fork.

multitasking-safe

This module uses flock() to lock the file while writing to it.

stamped filenames

This module supports a special tag in the filename that will expand to the current date/time/pid.

It is the same tag Log::Log4perl::Layout::PatternLayout uses, see Log::Log4perl::Layout::PatternLayout, chapter "Fine-tune the date". In short: Include a "%d{...}" in the filename where "..." is a format string according to the SimpleDateFormat in the Java World (http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html). See also Log::Log4perl::DateFormat for information about further restrictions.

In addition to the format provided by Log::Log4perl::DateFormat this module also supports '$$' for inserting the PID. This should not be needed regularly as this module also supports logfile sharing between processes, but if you've got a high load on your logfile or a system that doesn't support flock()...

HISTORY

0.99

Original version; created by h2xs 1.22 with options

        -A
        -C
        -X
        -b5.6.1
        -nLog::Dispatch::File::Rolling
        --skip-exporter
        -v0.99
1.00

Initial coding

1.01

Someone once said "Never feed them after midnight!"---Ok, let's append: "Never submit any code after midnight..."

Now it is working, I also included 4 tests.

1.02

No code change, just updated Makefile.PL to include correct author information and prerequisites.

SEE ALSO

Log::Dispatch::File, Log::Log4perl::Layout::PatternLayout, http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html, Log::Log4perl::DateFormat, 'perldoc -f flock', 'perldoc -f fork'.

AUTHOR

M. Jacob, <jacob@j-e-b.net>

COPYRIGHT AND LICENSE

Copyright (C) 2003 M. Jacob <jacob@j-e-b.net>

Based on:

  Log::Dispatch::File::Stamped by Eric Cholet <cholet@logilune.com>
  Log::Dispatch::FileRotate by Mark Pfeiffer, <markpf@mlp-consulting.com.au>

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 204:

You forgot a '=back' before '=head1'