Re: [Shinken-devel] Logging question - log level propagation
Status: Beta
Brought to you by:
naparuba
From: Francois M. <fm...@ac...> - 2012-08-20 00:27:32
|
On 12-08-19 7:24 PM, Francois Mikus wrote: > Another logging question. > > > The logger module knows about the default log level. > The main daemons all know about the configured logging level from the > INI file and can set their respective logging instances to match the > INI file level. > > Other objects that import the logger module never set the logging > level, so are using the default which is currently NOTSET meaning > DEBUG level. > > What is the best practice to make the logging level propagate to the > rest of the program. > Ok, I read through , Package ipapython :: Module log_manager, documentation from John Dennis. Pretty sweet logging wrapper. I expect that we have to do the following: import the logger module get a logger instance from the root (or a child of the root) using getLogger. Namespace is defined as the name passed in argument to getLogger. Unfortunately, the Shinken log.py wrapper class does not support namespaces. (I am not a python king, so correct me if I am wrong.) Having used get logger create get a logger instance, it should have the logging level set from the root. Root instance having been defined by one of the daemons which set level based on the INI. For debugging specific classes, the module log_manager provides a way to have specific levels set for logger instances which could differ from what is defined in an ancestor. (parent, grandparent, ..., root) For now, I will edit my changes to use getLogger and at least match the logging level set from the root. If we want to use a different logging wrapper module, we can do a bulk update later on. Have a good week, this is one bear I want to have wrestled before 1.2. X |