Hi!
I have the following logging.conf :
[loggers]
keys=root
keys=root
[handlers]
keys=roth
keys=roth
[formatters]
keys=simpleFormatter
keys=simpleFormatter
[logger_root]
level=INFO
handlers=roth
level=INFO
handlers=roth
[handler_roth]
class=RotatingFileHandler
level=INFO
formatter=simpleFormatter
args=('adssim.log','w', 200, 4)
class=RotatingFileHandler
level=INFO
formatter=simpleFormatter
args=('adssim.log','w', 200, 4)
[formatter_simpleFormatter]
format=%(asctime)s - %(message)s
datefmt=
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"
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