[Catalyst] How to enhance Log4Perl log-files about the loggend in user ($c->user->id)?

Christoph Metz mail-lao at web.de
Tue Jul 21 14:41:31 GMT 2009


Hi,

i got a Catalyst-App which inits a session on the startpage, after a
user logged sucessfully in with his login-data. Now, i also use
Log4Perl to do extensive logging, as far as the app is enough tested. so
i use the log4perl conf file this way:

__PACKAGE__->log(Catalyst::Log::Log4perl->new(__PACKAGE__->config->{home}.'/log.conf'));

where log.conf logs all data into a file myapp.log. There are many
useful cspecs to show really exact log-entrys but one is missing,
i want to see which debug/error/warn message was logged by which user.
so how to pass the logged in user ($c->user->id) into the
log4perl log-files?
custom cspecs like descripted on CPAN
Log::Log4Perl::Layout::PatternLayout are not able to access the
namespace of my app,
or at least i am not able to pass the context to the custom-cspecs sub
in the log4perl conf-file :(





More information about the Catalyst mailing list