I'm trying to use log4perl and I want to log in a module which is called from multiple different script files. Irrespective of who the caller is, the module should log the message to that particular callers adapter/log file. Can this be achieved?
testPackage.pmmy $conf = q( + log4perl.logger.testLog = ).$logging_level.q(, logApp log4perl.appender.logApp= Log::Log4perl::Appender::File + log4perl.appender.logApp.mode= append log4perl.appender.logApp.syswrite= 1 log4perl.appender.logApp.filename= test.log + log4perl.appender.logApp.layout= Log::Log4perl::Layout::Pa +tternLayout log4perl.appender.logApp.layout.ConversionPattern = %m % +n ) Log::Log4perl->init( \$conf ); + use testPackage; + &testPackage::foo();
Can some monks please see this and bestow the light on this.package testPackage; use Log::Log4perl qw(get_logger); sub foo { $logger = Log::Log4perl->get_logger(""); # IF I PUT testLog IN TH +E QUOTES THEN I'M GETTING THE blah IN THE CALLERS LOGS FILE $logger->info("blah"); } 1;
In reply to log4perl in module appending to callers log file by GB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |