Use fileConfig to configure custom handlers in Python

前端 未结 3 1189
别跟我提以往
别跟我提以往 2021-01-03 07:36

I\'m using a config file to configure my logger in a Python application. This is the file:

[loggers]
keys=root

[logger_root]
level=INFO
handlers=console

[h         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 07:51

    I ran into the same problem when using dictConfig The solution for me was to fully qualify the module path like this:

    [handler_file_rotating]
    class=logging.handlers.TimeRotatingFileHandler
    level=DEBUG
    formatter=file
    args=('../logs/twicker.log', 'd', 1, 5)
    

    You might want to give that a try

提交回复
热议问题