FOLLOW-UP how to use RotatingFileHandler
john peter
neuzhoundxx at yahoo.com
Mon Feb 13 16:33:55 EST 2006
the fix was to specify handler.RotatingFileHandler
does RotatingFileHandler work with Windows XP?
john peter <neuzhoundxx at yahoo.com> wrote:
Hi!
I have the following logging.conf :
[loggers]
keys=root
[handlers]
keys=roth
[formatters]
keys=simpleFormatter
[logger_root]
level=INFO
handlers=roth
[handler_roth]
class=RotatingFileHandler
level=INFO
formatter=simpleFormatter
args=('adssim.log','w', 200, 4)
[formatter_simpleFormatter]
format=%(asctime)s - %(message)s
datefmt=
and sampleLogging.py script:
import logging
import logging.config
logging.config.fileConfig("logging.conf")
logger = logging.getLogger("root")
for i in xrange(0, 5000):
logger.debug("debug message %s" % i)
logger.info("info message %s" % i)
logger.warn("warn! message %s" % i)
logger.error("error message %s" % i)
logger.critical("critical message %s" % i)
for some reason, i keep getting the following error message:
C:\adssim1>python sampleLogging.py
Traceback (most recent call last):
File "C:\Python24\lib\logging\config.py", line 157, in fileConfig
log.addHandler(handlers[hand])
KeyError: 'roth'
No handlers could be found for logger "root"
when i did a help(logging) on the logging module, i don't see RotatingFileHandler.
Could somebody please help? Thanks!
---------------------------------
What are the most popular cars? Find out at Yahoo! Autos --
http://mail.python.org/mailman/listinfo/python-list
---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060213/fa85fb43/attachment.html>
More information about the Python-list
mailing list