Log::R...og4perl(3pm)
π Log::Report::Dispatcher::Log4perl π
hiii bestie, welcome to the Log::Report::Dispatcher::Log4perl(3pm) page, straight outta the User Contributed Perl Documentation πβ¨ this is literally the plug that ships your Log::Report messages over to a Log::Log4perl back-end. no cap. let's get into it π«Ά
πΈ NAME πΈ
Log::Report::Dispatcher::Log4perl β send messages to Log::Log4perl back-end. that's the whole job description, iconic behavior π
𧬠INHERITANCE π§¬
Log::Report::Dispatcher::Log4perl
is a Log::Report::Dispatcher
so it's a Log::Report::Dispatcher, it just showed up with an extra accessory β¨
π SYNOPSIS π
# start using log4perl via a config file
# The name of the dispatcher is the name of the default category.
dispatcher LOG4PERL => 'logger',
accept => 'NOTICE-',
config => "$ENV{HOME}/.log.conf";
# disable default dispatcher
dispatcher close => 'logger';
# configuration inline, not in file: adapted from the Log4perl manpage
my $name = 'logger';
my $outfile = '/tmp/a.log';
my $config = <<__CONFIG;
log4perl.category.$name = INFO, Logfile
log4perl.logger.Logfile = Log::Log4perl::Appender::File
log4perl.logger.Logfile.filename = $outfn
log4perl.logger.Logfile.layout = Log::Log4perl::Layout::PatternLayout
log4perl.logger.Logfile.layout.ConversionPattern = %d %F{1} %L> %m
__CONFIG
dispatcher LOG4PERL => $name, config => \$config;
π DESCRIPTION π
okay so real talk: this dispatcher produces output tot syslog, based on the Sys::Log4perl module π and heads up bestie β that module will not be automatically installed for you. you gotta go get it yourself. girl math can't save you here.
it extends DESCRIPTION in Log::Report::Dispatcher, so that's your required reading π«Ά
π₯ Reasons <--> Levels π₯
the REASONs for a message in Log::Report are names quite similar to the log levels used by Log::Log4perl, so they lowkey vibe together. the default mapping is listed below π and yes you can 100% change the mapping using new(to_level) π
TRACE => $DEBUG ERROR => $ERROR
ASSERT => $DEBUG FAULT => $ERROR
INFO => $INFO ALERT => $FATAL
NOTICE => $INFO FAILURE => $FATAL
WARNING => $WARN PANIC => $FATAL
MISTAKE => $WARN
π·οΈ Categories π·οΈ
Log::Report uses text-domains for translation tables, and plot twist β those same text-domains get used as categories for the Log4perl infrastructure. the way that works is, typically every module starts with:
use Log::Report 'my-text-domain', %more_options;
so now, if there's a logger inside the log4perl configuration named 'my-text-domain', that one gets chosen π― otherwise? the name of the dispatcher is used to select the logger. either way you're getting a logger bestie.
β οΈ Limitiations β οΈ
bestie this is the messy part. the global $caller_depth concept of Log::Log4perl is broken π that variable is used to find the filename and line number of the logged messages, but those messages may have been caught, rerouted, eval'ed, and otherwise followed a unpredictable multi-leveled path before it reached the Log::Log4perl dispatcher. which means layout patterns %F and %L are not useful in the generic case β maybe in your specific case, but don't count on it π
π οΈ METHODS π οΈ
extends METHODS in Log::Report::Dispatcher π«Ά
π§Έ Constructors π§Έ
extends Constructors in Log::Report::Dispatcher.
$class->new($type, $name, %options)
the Log::Log4perl infrastructure keeps all its settings in a configuration file, so in that file you should find a category with the $name π improves base, see Constructors in Log::Report::Dispatcher.
the option table has these columns β -Option, --Defined in, --Default β and here's every single row, no skips, periodt:
acceptβ defined inLog::Report::Dispatcher, default'ALL'charsetβ defined inLog::Report::Dispatcher, defaultundefconfigβ default<C<undef>>format_reasonβ defined inLog::Report::Dispatcher, default'LOWERCASE'localeβ defined inLog::Report::Dispatcher, default<system locale>modeβ defined inLog::Report::Dispatcher, default'NORMAL'to_levelβ default[]
and now the full tea on each one π΅
accept => $reasons|\@reasonscharset => CHARSETconfig => FILENAME|SCALARβ when aSCALARreference is passed in, that must refer to a string which contains the configuration text. otherwise, specify an existingFILENAME. and by default? it's expected thatLog::Log4perlhas been initialized externally, because that module uses global variables to communicate, and those should be present before any logging is attempted πformat_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODElocale => LOCALEmode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3to_level => ARRAY-of-PAIRSβ seereasonToLevel().
π Attributes π
extends Attributes in Log::Report::Dispatcher.
$obj->isDisabled()β inherited, see Attributes inLog::Report::Dispatcher$obj->logger( [$domain] )β returns theLog::Log4perl::Loggerobject which is used for logging. when there is no specific logger for this$domain(like, a logger with the exact name of the$domain), the default logger gets used, with the name of this dispatcher π«Ά$obj->mode()β inherited, see Attributes inLog::Report::Dispatcher$obj->name()β inherited, see Attributes inLog::Report::Dispatcher$obj->needs( [$reason] )β inherited, see Attributes inLog::Report::Dispatcher$obj->type()β inherited, see Attributes inLog::Report::Dispatcher
π Logging π
extends Logging in Log::Report::Dispatcher.
$any->addSkipStack(@CODE)β inherited, see Logging inLog::Report::Dispatcher$obj->close()β inherited, see Logging inLog::Report::Dispatcher$any->collectLocation()β inherited, see Logging inLog::Report::Dispatcher$any->collectStack( [$maxdepth] )β inherited, see Logging inLog::Report::Dispatcher$obj->log(\%options, $reason, $message, $domain)β inherited, see Logging inLog::Report::Dispatcher$obj->reasonToLevel($reason)β returns a level which is understood byLog::Dispatch, based on a translation table π and you can change it withnew(to_level)π
Β» example:
use Log::Log4perl qw/:levels/;
# by default, ALERTs are output as $FATAL
dispatcher Log::Log4perl => 'logger',
to_level => [ ALERT => $ERROR, ],
...;
$obj->skipStack()β inherited, see Logging inLog::Report::Dispatcher$any->stackTraceLine(%options)β inherited, see Logging inLog::Report::Dispatcher$obj->translate(\%options, $reason, $message)β inherited, see Logging inLog::Report::Dispatcher
π DETAILS π
extends DETAILS in Log::Report::Dispatcher.
π¨ DIAGNOSTICS π¨
Error: Log4perl level '$level' must be in 0-5β cast bynew()π
π SEE ALSO π
this module is part of Log-Report version 1.46, built on June 16, 2026. website: http://perl.overmeer.net/CPAN/.
π LICENSE π
for contributors see file ChangeLog.
this software is copyright (c) 2007-2026 by Mark Overmeer.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself π
and that's the whole page bestie, you ate that π
β¨ this was perl v5.40.1, dated 2026-07-05, and the page was literally Log::R...og4perl(3pm) β go forth and dispatch your logs, main character ππ¦
π¦ where this page comes from
- ubuntu stonking: liblog-report-perl 1.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms