NAME
Dancer2::Logger::Log4perl - Dancer2 logger interface for Log4perl.
VERSION
version 0.04
SYNOPSIS
In your config.yml:
logger: log4perl
log: core
engines:
logger:
log4perl:
config_file: log4perl.conf
In your log4perl.conf:
log4perl.rootLogger = DEBUG, LOG1
log4perl.appender.LOG1 = Log::Log4perl::Appender::File
log4perl.appender.LOG1.filename = /var/log/mylog.log
log4perl.appender.LOG1.mode = append
log4perl.appender.LOG1.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.LOG1.layout.ConversionPattern = %d %p %m %n
DESCRIPTION
This class is an interface between Dancer2's logging engine abstraction layer and the Log::Log4perl library. In order to use it, you have to set the logger
engine to log4perl
.
Dancer2's core
level messages are passed to Log4perl as level trace
but will not be passed unless Dancer2's log
config is core
.
log
should be set a lower priority than the lowest priority as set in your Log4perl configuration. If it isn't, the log messages will not be passed to Log4perl.
CONFIGURATION
If you don't specify config_file
then Log4perl will easy init with the appropriate log level, as specified by Dancer2.
- config_file
-
You can specify the log4perl configuration file using the
config_file
option:logger: log4perl engines: logger: log4perl: config_file: log4perl.conf
- config_watch_interval
-
You can optionally specify the watch interval, either in seconds or as 'HUP':
logger: log4perl engines: logger: log4perl: config_file: log4perl.conf config_watch_interval: 30
CREDITS
This was originally developed by Ryan Larscheidt and Jon Miner at the University of Wisconsin. The initial version of this was built upon their final version. I cannot thank them enough for their work on this - it not only solved my needs at $work
, but also plugs a hole in our ecosystem.
AUTHOR
Jason A. Crome <cromedome@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Jason A. Crome.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.