From: Alexander H. <ale...@gm...> - 2014-03-17 13:39:00
|
On Mon, Mar 17, 2014 at 6:51 AM, Mike Schilli <m...@pe...> wrote: > On Fri, 14 Mar 2014, Claudio Steel wrote: > > > I have a new catalyst app and i think your module is exactly what I > need. However, I'm not > > able to find where I can set the file path that I want the log to be > written to. Any advice > > you have is appreciated. > > Check out > > > http://search.cpan.org/~mschilli/Log-Log4perl-1.42/lib/Log/Log4perl/Catalyst.pm > > which says that you can provide a configuration file like > > __PACKAGE__->log(Log::Log4perl::Catalyst->new('l4p.conf')); > > and in your configuration file you can specify a file appender with > a user-defined path: > > # l4p.conf > log4perl.category = WARN, Logfile > log4perl.appender.Logfile = Log::Log4perl::Appender::File > log4perl.appender.Logfile.filename = /foo/bar/test.log > log4perl.appender.Logfile.layout = > Log::Log4perl::Layout::PatternLayout > log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L> > %m %n > > Hope this helps! > > -- > -- Mike That's how we do it in our Catalyst apps: In the Catalyst app class: =item finalize_config Initializes the logger after the config file merging and loading is done. =cut sub finalize_config { my $class = shift; $class->next::method(@_); $class->log(Log::Log4perl::Catalyst->new($class->config->{log})); } That way we can configure the logging in the Catalyst config file(s) loaded by Plugin::ConfigLoader with merging and not have a separate one just for logging. Best regards, Alex > Mike Schilli > m...@pe... > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |