[Catalyst] Log::Log4perl and Catalys
Adam Jacob
adam at stalecoffee.org
Tue Jan 10 07:19:18 CET 2006
On Jan 9, 2006, at 3:15 PM, Dennis Daupert wrote:
> Adam, great idea! I just learned of the catalyst plugin for
> Log4Perl from your post; I'm very excited because I have used
> Log4Perl in a lot of cmd line perl projects, and it just makes life
> so much easier. Having it available in Catalyst will be great.
>
> I hope you do write one up.
Well, if you're already familiar with Log::Log4perl, using it with
Catalyst::Log::Log4perl should be a breeze.
In MyApp.pm, just add:
use Catalyst::Log::Log4perl;
MyApp->log(
Catalyst::Log::Log4perl->new("/path/to/log4perl.conf")
);
And you're done. If you don't provide an argument to new(), you'll
get a simple root logger that does the same output as the standard
Catalyst logger; otherwise, it should be the path to your Log4perl
config file.
Once configured, the plugin will set the component to the package who
called it. So, if you call it from MyApp::Controller::Kitty, it will
log to the myapp.controller.kitty component.
I'll put something up on the wiki tomorrow, with some more details.
Adam
More information about the Catalyst
mailing list