Logging module, a few questions
Irmen de Jong
irmen at -nospam-remove-this-xs4all.nl
Tue May 11 16:17:59 EDT 2004
Sorry to reply to myself, but I found the solution.
> 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?
Never mind. I didn't read the manual very well. It tells me
to add a "datefmt" to the formatter, which works like a charm.
However, the other thing still stands:
> 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?
Anybody got a good idea about this? Thanks!
--Irmen.
More information about the Python-list
mailing list