NAME
Log::Log4perl::ConfigByInifile - Get Log::Log4perl config from an ini-File
VERSION
0.03 - more Perl Best Practices with http://perlcritic.com/perl/critic.pl
SYNOPSIS
use Log::Log4perl::ConfigByInifile;
Log::Log4perl::ConfigByInifile->new(
{ ini_fn => 'acme.ini', }
);
my $logger = Log::Log4perl->get_logger('main');
$logger->debug('Starting...');
DESCRIPTION
Initialize Log::Log4perl with an ini-File. You must supply a section for Log4perl like this:
[log4perl]
log4perl.category = INFO, Logfile, Screen
log4perl.appender.Logfile = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = your_logfile.log
log4perl.appender.Logfile.mode = write
log4perl.appender.Logfile.layout = Log::Log4perl::Layout::SimpleLayout
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout
[myfiles]
...
SUBROUTINES/METHODS
new
This is the only method this module has. Calling it initializes Log::Log4perl with the section [log4perl] in your inifile.
Usage:
Log::Log4perl::ConfigByInifile->new(
{ ini_fn => 'acme.ini', }
);
my $logger = Log::Log4perl->get_logger('main');
$logger->debug('Starting...');
or
my $ini_obj = Config::IniFiles->new(
-file => 'acme.ini');
Log::Log4perl::ConfigByInifile->new(
{ ini_obj => $ini_obj, }
);
my $logger = Log::Log4perl->get_logger('main');
$logger->debug('Starting...');
Returns: Nothing. This routine only initializes Log::Log4perl.
Argument: Either ini_file or ini_obj.
Throws: Dies in all kinds of errors with a good message (inifile does not exist, not even single argument given etc.)
DEPENDENCIES
Depends on these Perl modules:
Log::Log4perl;
Params::Validate;
Config::IniFiles;
AUTHOR
Richard Lippmann
CPAN ID: HORSHACK
horshack@lisa.franken.de
http://lena.franken.de
LICENSE AND COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1).