NAME
Config::Any::Log4perl - Config::Any loader for Log4perl config files
VERSION
version 0.130020
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.
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
AUTHOR
Loïc TROCHET <losyme@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Loïc TROCHET.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.