首页
学习
活动
专区
圈层
工具
发布

python apscheduler 打印日志

import logging

logging.basicConfig() logging.getLogger('apscheduler').setLevel(logging.DEBUG)

def my_listener(event): if event.exception: print('The job crashed :(') else: print('The job worked :)')

当任务执行完或任务出错时,调用my_listener

scheduler.add_listener(my_listener, EVENT_JOB_EXECUTED | EVENT_JOB_ERROR)

回调事件

JobExecutionEvent

下一篇
举报
领券