找不到记录器“apscheduler.scheduler"的处理程序. [英] No handlers could be found for logger "apscheduler.scheduler"
问题描述
from apscheduler.scheduler import Scheduler
import os
class ListHref():
def __init__(self):
print 'In ListHref Class!'
self.name_hrefs = {}
self.name_img = {}
self.path = os.path.dirname(__file__)
print 'Out ListHref Class'
def other_function():...
def job(): #function named job
print 'In job!'
book_href = ListHref()
print 'book_href created!'
if __name__ == "__main__":
sched = Scheduler()
#job() #it's ok if job() called only
sched.daemonic = False #non daemon thread
sched.add_interval_job(job,minutes=0.1)
sched.start()
问题:如果只调用 job() 而不是 sched,没关系所以我很困惑为什么 init(self) 不能完全调用?并且找不到记录器apscheduler.scheduler"的处理程序有什么问题?以上python代码结果:
Problem: If call job() only instead of sched,it's ok So I am confused that why the init(self) cannot called completely? and what's wrong with 'No handerls could be found for logger "apscheduler.scheduler"'? Above python code result:
在作业()
在 ListHref 类中!
In ListHref Class!
找不到记录器apscheduler.scheduler"的处理程序
No handerls could be found for logger "apscheduler.scheduler"
在作业()
在 ListHref 类中!
In ListHref Class!
在作业()
在 ListHref 类中!
In ListHref Class!
...(以此类推)
推荐答案
apscheduler 正在使用 python logging 模块 需要初始化.日志记录有点复杂(请参阅链接),但最低限度是:
apscheduler is using the python logging module which needs to be initialized. Logging is a bit complicated (see the link) but the minimum is to:
import logging
logging.basicConfig()
basicConfig 支持一些常见的日志记录功能,但值得了解记录器的一些更复杂的用途.
basicConfig supports some common logging features but its worth figuring out some of the more sophisticated uses for the logger.
这篇关于找不到记录器“apscheduler.scheduler"的处理程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!