I am trying to configure some logging for Python. From http://docs.python.org/howto/logging.html It is recommended that you use the YAML configuration file -
version: 1 formatters: simple: format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' handlers: console: class: logging.StreamHandler level: DEBUG formatter: simple stream: ext://sys.stdout loggers: simpleExample: level: DEBUG handlers: [console] propagate: no root: level: DEBUG handlers: [console]
In my code, I use this as -
import logging.config logging.config.dictConfig('logging.config')
However, when I start, I get an error
Traceback (most recent call last): File "TestLogger.py", line 62, in <module> Test5() File "TestLogger.py", line 55, in Test5 logging.config.dictConfig('logging.dict.2.config') File "/usr/lib/python2.7/logging/config.py", line 776, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python2.7/logging/config.py", line 380, in __init__ self.config = ConvertingDict(config) ValueError: dictionary update sequence element
So it seems that I am calling the configuration file in the wrong way. You just can't find the right way to call it. Please help me? Many thanks
Nupur source share