From: Alexander H. <ale...@gm...> - 2014-03-18 12:39:28
|
On Tue, Mar 18, 2014 at 7:59 AM, Claudio Steel <cla...@gm...>wrote: > Ok I have read both of these but I'm a little fuzzy on what I did wrong > since it seems so straight forward. > 1. Have it installed and added to the makefile > 2. In my apps 'myapp.pm' I added > use Log::Log4perl::Catalyst; > and ... > __PACKAGE__->log(Log::Log4perl::Catalyst->new('log4perl.conf')); > 3. I made a file chmod to 775 in the root directory of the app called > log4perl.conf. > 4. In the config file i added the following: > #log4perl.category= WARN, Logfile > log4perl.appender.LOGFILE=Log::Log4perl::Appender::File > log4perl.appender.Logfile.filename = /log/debug.log > 5. I made a directory, chmod to 775 recursive, in the root directory, > 'log/debug.log' > > So, unless I comment line 1 of the config I get a 502 error. Once > commented the app restarts but doesn't log anything. Any ideas? > You didn't specify the absolute path of log4perl.conf and you can't rely on the current directory. Use File::ShareDir of what I suggested previously. > > On Mon, Mar 17, 2014 at 9:38 AM, Alexander Hartmaier < > ale...@gm...> wrote: > >> 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 >>> >> >> > > > -- > -Claudio Steel > |