python logging writes an empty file

Ovidiu Deac ovidiudeac at
Fri Mar 26 15:29:43 CET 2010

> You set le level of your handler, but did not set the level of the logger
> itself.
> Replace file.setLevel(logging.INFO) by
> logging.getLogger().setLevel(logging.INFO)
> Log events are matched versus the logger level 1st, then the handler level
> (if applicable). Most of the time you don't need to tune your handler
> levels.

Right. Thanks a lot!!!

Now for the second part, any idea why logging.config.fileConfig doesn't work?

Now the logging.conf looks like this:

keys: detailed

keys: console,file

keys: root

format: %(name)s:%(levelname)s %(module)s:%(lineno)d:  %(message)s

class: StreamHandler
args: []
formatter: detailed

args=('output.log', 'w')

level: INFO
handlers: file

More information about the Python-list mailing list