DBHandler class for logging?

Diez B. Roggisch deets at nospam.web.de
Wed Sep 23 00:19:01 CEST 2009

kj schrieb:
> In <7hsukcF2tqhtvU1 at mid.uni-berlin.de> "Diez B. Roggisch" <deets at nospam.web.de> writes:
>> kj schrieb:
>>> I've come across mentions of a mythical class of logging handlers
>>> called DBHandler, but I can't find it anywhere.
>>> Could someone please point me in the right direction?
>>> (FWIW, I'm looking for ways to log messages to PostgreSQL RDBMS.)
>> I'm not aware such a thing is part of the standard logging package. But 
>> it's trivial to write one, we did so ourselves. Depending on your 
>> version of python, you need to inject the class into the 
>> logging.handlers-module to make it loadable by the logfile-format.
> I'm sorry for my ignorance, but what exactly do you mean by
> "injecting" the new class into the "logging.handlers-module"?  And
> what is "the logfile-format"?

The logfile format as specified in the documentation fo the 
logging-module. And due to some restrictions in the way how this 
instantiates declared logging-handlers, you need to set your own class 
into logging.handlers:

import logging.handlers as h

class MyHandler(...):

h.MyHandler = MyHandler

# now you can load the config.


More information about the Python-list mailing list