Michael West wrote on 3/4/2004, 5:36 AM:
> Do I have to add get_logger to every method and sub or is there a
> more general way of handling it. With get and set methods the
> logging is most of the code.
To retrieve a logger, using
use Log::Log4perl qw(get_logger);
my $logger = get_logger("category");
$logger->debug("Your Message");
is the recommended procedure. However, if you like more convenience,
Log::Log4perl offers macros like DEBUG(), INFO(), etc. in :easy mode:
use Log::Log4perl qw(:easy);
sub your_function {
# ...
DEBUG("Your Message");
}
More on that, check out the "Stealth Logger" section in the manual:
http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl.html#3c65f
--
-- Mike
Mike Schilli
m...@pe...
|