Seite 1 von 1

still-logging.

Verfasst: Sonntag 18. Mai 2014, 15:44
von Tariiq
still logging....pliz run this code and telll mi what u get...i run it and this is what i get..

Code: Alles auswählen

Traceback (most recent call last):
  File "/Users/Genius/Desktop/newpy/in.py", line 3, in <module>
    logging.config.fileConfig('login.conf')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 70, in fileConfig
    formatters = _create_formatters(cp)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 106, in _create_formatters
    flist = cp.get("formatters", "keys")
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 607, in get
    raise NoSectionError(section)
NoSectionError: No section: 'formatters'
.

Code: Alles auswählen

import logging
import logging.config
logging.config.fileConfig('login.conf')
logger=logging.getLogger('henry')
print("an insect maults by shedding off its wings")
logger.debug("debug message")
logger.info("info message")
logger.warn("warn message")
logger.error("error message")
logger.critical("critical message")

Code: Alles auswählen

[ loggers ]
keys=root,henry

[ handlers ]
keys=consoleHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[logger_henry]
level=DEBUG
handlers=consoleHandler
qualname=henry
propagate=0

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout, )

[formatter_simpleFormatter]
format=%(asctime) s - %(name) s - %(levelname) s - %(message) s
datefmt=