Re: Logging module gives duplicate log entries

2007-08-22 Thread Peter Otten
Shiao wrote: > Maybe my question wasn't very clear. What I meant is that these four > lines lead in my case to two entries per logged event: > > applog = logging.getLogger() > applog.setLevel(logging.DEBUG) > hdl = logging.FileHandler('/tmp/foo.log') > applog.addHandler(hdl) > > However if I REP

Re: Logging module gives duplicate log entries

2007-08-21 Thread Shiao
Maybe my question wasn't very clear. What I meant is that these four lines lead in my case to two entries per logged event: applog = logging.getLogger() applog.setLevel(logging.DEBUG) hdl = logging.FileHandler('/tmp/foo.log') applog.addHandler(hdl) However if I REPLACE the above by: logging.basi

Re: Logging module gives duplicate log entries

2007-08-21 Thread Peter Otten
Shiao wrote: >> You need to remove the handler from the logging object >> >> # remove the handler once you are done >> applog.removeHandler(hdl) > I'm not sure how this could help. If you have multiple handlers you'll get a logged message for every handler. In your code logging.basicConfig() im

Re: Logging module gives duplicate log entries

2007-08-21 Thread Shiao
> > You need to remove the handler from the logging object > > # remove the handler once you are done > applog.removeHandler(hdl) > > Cheers, > amit. > I'm not sure how this could help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging module gives duplicate log entries

2007-08-21 Thread Amit Khemka
On 8/21/07, Shiao <[EMAIL PROTECTED]> wrote: > Hi, > I am getting duplicate log entries with the logging module. > > The following behaves as expected, leading to one log entry for each > logged event: > > logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log') > > But this results in two