Hullo, I have started to use Python's logging, and got a problem. I have created some loggers and wrote some lines in the log. The problem is, that most of the lines appear doubled in the log, and some lines do not appear at all.
Any ideas or comments are wellcome, Gabor Here is the code: import sys import logging l = logging.getLogger('XmlTester') handler = logging.StreamHandler(sys.stderr) l.addHandler(handler) formatter = logging.Formatter("%(name)s %(asctime)s %(filename)s %(lineno)d %(levelname)s %(message)s") handler.setFormatter(formatter) la = logging.getLogger('XmlTester.XmlParser') handler = logging.StreamHandler(sys.stderr) la.addHandler(handler) handler.setFormatter(formatter) lb = logging.getLogger('XmlTester.TestExecutor') handler = logging.StreamHandler(sys.stderr) lb.addHandler(handler) handler.setFormatter(formatter) l.setLevel(logging.DEBUG) la.setLevel(logging.DEBUG) lb.setLevel(logging.DEBUG) l.debug("Start") la.debug("Start la") lb.debug("This debug") lb.info("This started.") l.info("Info written") l.warning("This is a warning") l.error("Error occured") test = "Info.pck" la.info("Hi there!") la.critical("No file named '%s'"%test) l.critical("End of all") Here is the output: XmlTester.XmlParser 2007-07-31 10:34:12,303 plogtest.py 21 DEBUG Start la XmlTester.XmlParser 2007-07-31 10:34:12,303 plogtest.py 21 DEBUG Start la XmlTester.TestExecutor 2007-07-31 10:34:12,319 plogtest.py 22 DEBUG This debug XmlTester.TestExecutor 2007-07-31 10:34:12,319 plogtest.py 22 DEBUG This debug XmlTester.TestExecutor 2007-07-31 10:34:12,319 plogtest.py 23 INFO This started. XmlTester.TestExecutor 2007-07-31 10:34:12,319 plogtest.py 23 INFO This started. XmlTester.XmlParser 2007-07-31 10:34:12,319 plogtest.py 28 INFO Hi there! XmlTester.XmlParser 2007-07-31 10:34:12,319 plogtest.py 28 INFO Hi there! XmlTester.XmlParser 2007-07-31 10:34:12,319 plogtest.py 29 CRITICAL No file named 'Info.pck' XmlTester.XmlParser 2007-07-31 10:34:12,319 plogtest.py 29 CRITICAL No file named 'Info.pck' XmlTester 2007-07-31 10:34:12,319 plogtest.py 30 CRITICAL End of all
-- http://mail.python.org/mailman/listinfo/python-list