Log::Log4perl::ConfigByInifile - Get Log::Log4perl config from an ini-File
0.03 - more Perl Best Practices with http://perlcritic.com/perl/critic.pl
use Log::Log4perl::ConfigByInifile; Log::Log4perl::ConfigByInifile->new( { ini_fn => 'acme.ini', } ); my $logger = Log::Log4perl->get_logger('main'); $logger->debug('Starting...');
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] ...
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.)
Depends on these Perl modules:
Log::Log4perl; Params::Validate; Config::IniFiles;
Richard Lippmann CPAN ID: HORSHACK horshack@lisa.franken.de http://lena.franken.de
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.
perl(1).
To install Log::Log4perl::ConfigByInifile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Log4perl::ConfigByInifile
CPAN shell
perl -MCPAN -e shell install Log::Log4perl::ConfigByInifile
For more information on module installation, please visit the detailed CPAN module installation guide.