Log Settings To Disable Automatic Logging


(Tomasz) #1

What value should set in levels property of CLogRouter to disable automatic logging of anything? Documentation says, that when levels is empty, everything is logged. How to log nothing?

Why do I need this? I just want to define my log routes, but forbit Yii from logging anything – I want to have full control over logging process and log only data, that I put through Yii:log() method.


(Maurizio Domba Cerin) #2

How about setting a custom level and use that one in you Yii:log() calls.


(Tomasz) #3

That is a reasonable solution.

But it sounds to me like a typical workaround. So, it seems, that scenario like mine, isn’t currently handled and – what do you think about rising an issue to fix this?

IMHO setting levels to empty should handle "my" scenario (do not automatically log anything), while setting it to "all" or "*" should actually log everything.


(Maurizio Domba Cerin) #4

It’s not a workaround it’s a solution because to log only “your” calls you still need to set a custom level. If you don’t set a custom level, “info” is the default and then the Yii core info messages would be logged too and you don’t want that. So in the end you still need to set your custom level in the log() call and in the logger config.


(Tomasz) #5

Ah, I see. Thanks! :]