On Thu, 11 Mar 2010, Mesdaq, Ali wrote:

> I have looked around the documentation but have not seen anything that
> discusses the ability to use Log4perl's convenience functions inside
> of catalyst apps. Namely the shortcuts of TRACE, DEBUG(), INFO(),

Funny, after thinking about this for quite some time now, suddenly,
after talking to the Catalyst folks yesterday, I realized that you can
already do that! :)

See, there's nothing special about $c->log->debug() except that it
obtains a reference to a Log4perl logger (given you're using Log4perl
with Catalyst of course). DEBUG() in :easy mode does exactly the same.

So, just use Log::Log4perl::Catalyst to initialize Log4perl with
Catalyst (check the manpage for that) and then use Log::Log4perl
qw(:easy) for the macros.

I've added it to the documentation:

     
http://github.com/mschilli/log4perl/commit/aeaf10cca8e8c5ba64bc2783109dc5b345436d91

Enjoy! :)

-- Mike

Mike Schilli
m...@perlmeister.com



> WARN(), ERROR(), FATAL(), and ALWAYS. Call me lazy but I am trying to
> avoid doing things like: $c->log->debug("hello"); now that I have been
> spoiled with using DEBUG("hello"); in other places that I use
> Log4perl.
>
> Thanks,
> ------------------------------------------
> Ali Mesdaq (CISSP, GIAC-GREM)
> Sr. Security Researcher
> Websense Security Labs
> http://www.WebsenseSecurityLabs.com
> ------------------------------------------
>
>
>
>
> Protected by Websense Hosted Email Security -- www.websense.com
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> log4perl-devel mailing list
> log4perl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to