ในสคริปต์ python ฉันกำลังเขียนฉันกำลังพยายามบันทึกเหตุการณ์โดยใช้โมดูลการบันทึก ฉันมีรหัสต่อไปนี้เพื่อกำหนดค่าคนตัดไม้ของฉัน:
ERROR_FORMAT = "%(levelname)s at %(asctime)s in %(funcName)s in %(filename) at line %(lineno)d: %(message)s"
DEBUG_FORMAT = "%(lineno)d in %(filename)s at %(asctime)s: %(message)s"
LOG_CONFIG = {'version':1,
'formatters':{'error':{'format':ERROR_FORMAT},
'debug':{'format':DEBUG_FORMAT}},
'handlers':{'console':{'class':'logging.StreamHandler',
'formatter':'debug',
'level':logging.DEBUG},
'file':{'class':'logging.FileHandler',
'filename':'/usr/local/logs/DatabaseUpdate.log',
'formatter':'error',
'level':logging.ERROR}},
'root':{'handlers':('console', 'file')}}
logging.config.dictConfig(LOG_CONFIG)
เมื่อฉันพยายามเรียกใช้logging.debug("Some string")
ฉันไม่ได้รับเอาต์พุตไปยังคอนโซลแม้ว่าหน้านี้ในเอกสารจะบอกว่าlogging.debug
ควรมีข้อความ root logger ออกมา เหตุใดโปรแกรมของฉันจึงไม่แสดงผลอะไรเลยและฉันจะแก้ไขได้อย่างไร