[Catalyst] Problem with $c->log always on

Matt S Trout dbix-class at trout.me.uk
Wed Sep 13 03:05:05 CEST 2006


Nate Wiger wrote:
> Matt S Trout wrote:
>> Nate Wiger wrote:
>>> It looks like $c->log is always on in a given Catalyst plugin. I have 
>>> simple, standard code like this:
>>>
>>>     $c->log->debug("some message");
>>>     $c->log->debug(Dumper(\%hash)) if $c->log->is_debug;
>>>
>>> When I dump out the $c->log->is*, all of them return true (actually, 
>>> 1/4/16 depending on the level, I assume this is a bitmask byproduct).
>>>
>>> Any ideas? Anyone else seen this? I even double-checked my classes to 
>>> make sure they aren't overriding it...
>> Log level config is separate from debug mode.
>>
>> __PACKAGE__->log(Catalyst::Log->new(@levels));
>>
>> or
>>
>> $c->log->debug(...) if $c->debug; # this is what the Cat internals do
> 
> Ok, perhaps I'm a bit confused... reading the Catalyst::Log manpage, it 
> seems I should just be able to write this:
> 
>     $c->log->whatever_level("message");
> 
> And it will/won't be shown depending on the runtime level config. Is 
> that correct?

Yes, but you've shown nothing indicating you've altered the runtime level 
config from "all levels" which is the default.

$c->log->is_debug is determined by the logging config. Whether the app is in 
debug mode is nothing to do with that, that's reflected by $c->debug as I said.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list