I have following log configuration file in python:
[loggers]
keys=root
[logger_root]
handlers=screen,file
[formatters]
keys=simple,complex
[formatter_simple]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
[formatter_complex]
format=[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s
[handlers]
keys=file,screen
[handler_file]
class=handlers.TimedRotatingFileHandler
interval=midnight
backupCount=5
formatter=complex
level=DEBUG
args=('spartacus.log',)
[handler_screen]
class=StreamHandler
formatter=complex
level=DEBUG
args=(sys.stdout,)
Run following python program:
import logging.config
logging.config.fileConfig("logging.conf")
logging.debug("1")
logging.info("2")
logging.warn("3")
logging.error("4")
logging.critical("5")
The output is:
[2014-04-01 11:25:04,720] WARNING [root.<module>:11] 3
[2014-04-01 11:25:04,720] ERROR [root.<module>:12] 4
[2014-04-01 11:25:04,720] CRITICAL [root.<module>:13] 5
Where are my INFO and DEBUG level log entries?