NAME

Config::Any::Log4perl - Config::Any loader for Log4perl config files.

VERSION

Version 0.02

SYNOPSIS

use Config::Any;

...

my $config = Config::Any->load_files({
      files => \@files
    , use_ext => 1
    , driver_args => { Log4perl => { config_name => 'logger' }}
});

...

See Config::Any

DESCRIPTION

Loads Log4perl configuration files.

Example:

### sample.log4perl
log4perl.logger                                   = TRACE, SCREEN
log4perl.appender.SCREEN                          = Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.stderr                   = 1
log4perl.appender.SCREEN.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SCREEN.layout.ConversionPattern = %d %-5p [%5P] %m%n

METHODS

extensions

Return an array of valid extensions.

Return value

ARRAY - qw( log4perl ).

load($file, $args)

Attempts to load a Log4perl config file.

Parameters

$file - SCALAR - The Log4perl config file.

$args - HASHREF - optional - Possible options:

    config_name - A key used to store configuration.

Return value

HASHREF - Log4perl configuration.

Example

With this Log4perl configuration file:

### sample.log4perl
log4perl.logger                                   = TRACE, SCREEN
log4perl.appender.SCREEN                          = Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.stderr                   = 1
log4perl.appender.SCREEN.layout                   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SCREEN.layout.ConversionPattern = %d %-5p [%5P] %m%n

If config_name is undefined the return value is:

{
    'log4perl.appender.SCREEN.layout' => 'Log::Log4perl::Layout::PatternLayout',
    'log4perl.appender.SCREEN.layout.ConversionPattern' => '%d %-5p [%5P] %m%n',
    'log4perl.appender.SCREEN.stderr' => '1',
    'log4perl.logger' => 'TRACE, SCREEN',
    'log4perl.appender.SCREEN' => 'Log::Log4perl::Appender::Screen'
}

If config_name is defined like this:

config_name => 'logger'

the return value is:

{
    'logger' => {
        'log4perl.appender.SCREEN.layout' => 'Log::Log4perl::Layout::PatternLayout',
        'log4perl.appender.SCREEN.layout.ConversionPattern' => '%d %-5p [%5P] %m%n',
        'log4perl.appender.SCREEN.stderr' => '1',
        'log4perl.appender.SCREEN' => 'Log::Log4perl::Appender::Screen',
        'log4perl.logger' => 'TRACE, SCREEN'
    }
}

SEE ALSO

Log::Log4perl

AUTHOR

Loïc TROCHET <losyme@gmail.com>

Repository available at https://github.com/losyme/Config-Any-Log4perl.

COPYRIGHT AND LICENSE

Copyright (c) 2012 by Loïc TROCHET.

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

See http://dev.perl.org/licenses/ for more information.