logging producing redundant entries

Jed Parsons jedp at ilm.com
Thu Mar 30 19:46:02 EST 2006


Hi,

I'm using the logging module for the first time.  I'm using it from 
within Zope Extensions.

My problem is that, for every event logged, the logger is producing 
multiple identical entries with the timestamp the same down to the 
millisecond.

Is this something I'm doing wrong?

Log snippet:

2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons

I would like only one of the above lines in my log file; not all those 
copies.

I'm using this simple logging setup at the top of a zope Extension module:

     import logging
     # basicConfig for python 2.3
     logging.basicConfig()
     _logger = logging.getLogger("login")
     _logger.setLevel(logging.DEBUG)
     _handler = logging.FileHandler(LOG_ROOT, 'login.log'))
     _formatter = logging.Formatter("%(asctime)s %(levelname)s: 
%(message)s")
     _handler.setFormatter(_formatter)
     _logger.addHandler(_handler)

So these are global to the module.  The log lines above were produced by 
what I expected would be a single call to _logger.info() in a function 
in the module:

     _logger.info("Login: %s %s" % (firstname, lastname))

Can anyone explain what I'm doing wrong?  Many thanks,
j


-- 
Jed Parsons       Industrial Light + Magic  (415) 746-2974
	
grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6))))}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));



More information about the Python-list mailing list