Ovidiu Deac wrote:
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:

[formatters]
keys: detailed

[handlers]
keys: console,file

[loggers]
keys: root

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

[handler_console]
class: StreamHandler
args: []
formatter: detailed

[handler_file]
class=FileHandler
formatter=detailed
args=('output.log', 'w')
filename=output.log
mode=w

[logger_root]
level: INFO
handlers: file
I'm not sure, I don't use configuration file my loggers.

I don't think the handler_file should have a filename or mode field though. Try removing them.

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to