[Catalyst] Selective debug output

Jonathan Rockway jon at jrock.us
Wed Nov 7 21:21:12 GMT 2007


Karim Nassar wrote:
> At my former employer, we had a logging infrastructure, but it had to
> work with more than just catalyst, so it was not optimal.

I see what you're saying, but Catalyst can easily support custom
logging.  You can make $c->log return whatever you want (see
Catalyst::Log::Log4perl for an example).  From there, you can call any
methods that you want on the object, so you can log whatever you want. 
CPAN components assume that $c->log->can(all(info debug warn error)) is
true... but you probably don't care about internal debugging information
for CPAN modules in production, so you can just turn their logging off
and only worry about messages generated by your application.

>
> I feel what is needed is the ability to log in any module such that I
> can debug/log at will, and not have to worry about removing debug
> statements:

Roll your own.

> In a production environment, it'd be nice to be able to send certain
> log levels through other channels as well i.e.: alternate log files or
> some monitoring program's mechanism, but having the rest in place
> first is extremely nice during development, and makes site monitoring
> easier.

log4perl does this.

Hope this points you in the right direction.  Let me know if I'm
completely off-base here :)

Regards,
Jonathan Rockway



More information about the Catalyst mailing list