I'm trying to write out to a log in python; I would like to be able to load the configuration from a file, but I am getting an error after calling:
logging.config.fileConfig('logging.conf') Traceback (most recent call last): File "/usr/lib64/python2.4/logging/config.py", line 157, in fileConfig log.addHandler(handlers[hand]) KeyError: 'simpleHandler'
My config is:
  [loggers]
  keys=root
  [handlers]
  keys=simpleHandler
  [formatters]
  keys=simpleFormatter
  [logger_root]
  level=DEBUG
  handlers=simpleHandler
  [handler_simpleHandler]
  formatter=simpleFormatter
  class=handlers.RotatingFileHandler
  filename=/tmp/test.log
  maxBytes=31457280
  level=DEBUG
  [formatter_simpleFormatter]
  format=%(asctime)s %(levelname)s %(message)s
  datefmt=%Y/%m/%d %H:%M:%S
please help me determine what the error is, thanks.
Try this in your filehandler:
    [handler_simpleHandler]
    formatter=simpleFormatter
    class=handlers.RotatingFileHandler
    maxBytes=31457280
    level=DEBUG
    args=('/tmp/test.log',)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With