Logging Best Practices


I’m starting a new Yii (v1.1) based project and I wanted to reconsider the logging best practices.

Up till now I’ve used file logging and calling the log method was like this:

Yii::log("Some logged message", CLogger::LEVEL_ERROR, __METHOD__); 

// LEVEL_ERROR is of course changed per use case, in the code 

The above usage is useful for me as it allows logging it all, with varying log levels and most importantly, the ability to parse the log file to my preference, per future decision on such parsing.

Yet, as I opened with, I’m wandering what’s other best practices on the issue of logging.

Thanks for sharing!