Log-Log4perl-AutoInit

 view release on metacpan or  search on metacpan

lib/Log/Log4perl/AutoInit.pm  view on Meta::CPAN

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.

=cut

sub get_logger {
    my $category = shift;
    _init();
    $category = $default_category unless defined $category;
    $category = (caller)[0]       unless defined $category;
    return Log::Log4perl::get_logger($category);
}

my $initialized = 0;    # move to state when we can drop 5.8 support

=head2 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.



( run in 0.313 second using v1.01-cache-2.11-cpan-a3c8064c92c )