import logging
logger=logging.getLogger()
logger.setLevel(logging.DEBUG)
#控制台输出日志
'''consle=logging.StreamHandler()
logger.addHandler(consle)'''
#文件输出日志
# file_handle=logging.FileHandler(r"F:QQlog est.log")
# formatter=logging.Formatter('%(asctime)s %(filename)s---> %(funcName)s %(levelno)s %(levelname)s --->%(message)s')
# file_handle.setFormatter(formatter)
# logger.addHandler(file_handle)
file_handle=logging.FileHandler(r"F:QQlog est.log")
formatter=logging.Formatter("%(asctime)s %(filename)s ----> %(funcName)s %(levelno)s %(levelname)s -->%(message)s")
file_handle.setFormatter(formatter)
logger.addHandler(file_handle)
logger.debug("test666")
print("test885")
file_handle.close()
logger.removeHandler(file_handle)