still-logging.

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Tariiq
User
Beiträge: 12
Registriert: Freitag 2. Mai 2014, 07:33

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=

Antworten