Making Catalyst Debug Logs Really Be Quiet
I have recently been adding and updating tests to my biggest Catalyst project and have been a bit perplexed by the debugging output...in particular that I was seeing any of it! Generally, I like to see all that output scroll by, but when running Test::WWW::Mechanize::Catalyst
tests over and over again, it just clutters things and obfuscates any failures.
I had removed -Debug
from the plugin list and tried CATALYST_DEBUG=0
env variable, but I continued to see a lot of the debug messages. After a bit of googling, I finally learned that this was a feature.
The -Debug
flag and CATALYST_DEBUG
env variable are just for the internal Catalyst debug logs. What I needed to do was to set the log levels with MyApp->log->levels
to control what is dumped with $c->log->debug
and its brethren. In general, I want my custom debugging and the internal Catalyst debugging to be tied together, so I added the following to lib/MyApp.pm
after __PACKAGE__->setup
:
__PACKAGE__->log->levels( qw/info warn error fatal/ ) unless __PACKAGE__->debug;
Now, if I run the server with -d
or do something like "CATALYST_DEBUG=1 prove -l t
" I see all the usual log message, otherwise I get nice clean test output.