The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Log4perl::AutoInit - Log4Perl with autoinitialization.

SYNOPSIS

 use Log::Log4perl::AutoInit qw(get_logger);
 Log::Log4perl::AutoInit->set_config('path/to/l4p.conf');

 get_logger->warning('l4p initialized and warning logged');

DESCRIPTION

This module provides a simple wrapper around Log::Log4perl for cases where initialization may need to be delayed until a statup process is complete, but where configuration may need to be registered before that point. In essence it provides a way to delay logger initialization until the logger is actually needed or used.

A key use for this is for daemons where configuration may be set on loading a Perl module, but where file handles may be subsequently closed. This module allows you to delay initialization until you are actually logging, with an ability to initialize the logger at a specific point and reinitialize if necessary.

EXPORT

get_logger

SUBROUTINES/METHODS

set_config

This API sets the configuration for subsequent logger initialization. This only caches the config and does no initialization itself. This is safe to call at any point in the program but if logging is already being done, you must reinitialize (see initialize_now() below).

set_default_category

Sets the default category for all future loggers. If not found the callers' module name is used. To unset pass in undef.

get_logger

Initializes, if necessary, and returns a logger with the identical syntax to Log4perl::get_logger(). If you close the file handles out from under the logger, you must reinitialize immediately after. See initialize_now() below.

initialize_now(bool $reinitialize);

This initializes Log4perl. If $reinitialize is set, it allows Log4perl to be explicitly reinitialized. This can be used to force a reinitialization, for example after file handles have been closed or after a configuration change.

AUTHOR

Binary.com, <perl@binary.com>

BUGS

Please report any bugs or feature requests to bug-log-log4perl-autoinit at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Log-Log4perl-AutoInit. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Log::Log4perl::AutoInit

You can also look for information at:

ACKNOWLEDGEMENTS