logging module: problem with custom handlers

Andreas Jung lists at andreas-jung.com
Mon Oct 27 06:50:54 EST 2003


I am trying to write a custom logger with a custom handler:

class MyHandler(StreamHandler):
  pass

class Logger:

  def __init__(self):
      self._l = logging.getLogger('someident')
      self._l.addHandler(MyHandler('/path/to/logfile'))


Now I want to configure this logger through a configuration
file. How can I refer to the new handler in the configuration file?
Something like "class=MyHandler" did not work.

Any ideas?

Thanks,
Andreas






More information about the Python-list mailing list