Python logging not outputting anything

前端 未结 4 1041
无人及你
无人及你 2021-01-29 21:06

In a python script I am writing, I am trying to log events using the logging module. I have the following code to configure my logger:

ERROR_FORMAT = \"%(levelna         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-29 21:36

    Maybe try this? It seems the problem is solved after remove all the handlers in my case.

    for handler in logging.root.handlers[:]:
        logging.root.removeHandler(handler)
    
    logging.basicConfig(filename='output.log', level=logging.INFO)
    

提交回复
热议问题