This sets all loggers under the Bar::Twix hierarchy on priority WARN and attaches a later-to-be-defined Screen appender to them. Settings for the root appender (which doesn't have a name) can be accomplished by simply omitting the name:

log4perl.logger = FATAL, Database, Mailer

This sets the root appender's level to FATAL and also attaches the later-to-be-defined appenders Database and Mailer to it.

The additivity flag of a logger is set or cleared via the additivity keyword:

log4perl.additivity.Bar.Twix = 0|1

(Note the reversed order of keyword and logger name, resulting from the dilemma that a logger name could end in .additivity according to the log4j documentation).

Appender names used in Log4perl configuration file lines need to be resolved later on, in order to define the appender's properties and its layout. To specify properties of an appender, just use the appender keyword after the log4perl intro and the appender's name:

This sets a priority of DEBUG for loggers in the Bar::Twix hierarchy and assigns the A1 appender to it, which is later on resolved to be an appender of type Log::Log4perl::Appender::File, simply appending to a log file. According to the Log::Log4perl::Appender::File manpage, the filename parameter specifies the name of the log file and the mode parameter can be set to append or write (the former will append to the logfile if one with the specified name already exists while the latter would clobber and overwrite it).

The order of the entries in the configuration file is not important, Log::Log4perl will read in the entire file first and try to make sense of the lines after it knows the entire context.

You can very well define all loggers first and then their appenders (you could even define your appenders first and then your loggers, but let's not go there):

and still have the logger append to the logfile by default, although the Log::Log4perl::Appender::File module does exactly the opposite. This is due to some nasty trickery Log::Log4perl performs behind the scenes to make sure that beginner's CGI applications don't clobber the log file every time they're called.