Logging module, a few questions

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Sat May 8 10:38:18 EDT 2004


Hello
I'm using the logging module in Python 2.3.3, with a format string
containing %(asctime). But it now dumps a full date +timestamp in
the log, which is nice but sometimes I only want the timestamp
(no date). Is there an easy way to change this? How can I make
%(asctime) dump only the time?

I'm using a configuration file to set up the logging.

Which brings me to another thing.
In java's log4j, it's easy to "silence" or "enable" specific
parts of a logging hierarchy, by doing:

log4j.category.nl.company = DEBUG
log4j.category.nl.company.lib = WARN
log4j.category.org.apache = WARN

and so on.

I see no easy way of doing the same for Python's logging module;
it seems that I have to create a handler for each of the different
parts of the hierarchy of which I want to set the loglevel.
Am I missing something?


Thanks!

--Irmen de Jong



More information about the Python-list mailing list