首页 > 其他分享 >gunicorn运行报错Error: Unable to configure root logger: Unable to add handler ‘console‘: ‘console‘

gunicorn运行报错Error: Unable to configure root logger: Unable to add handler ‘console‘: ‘console‘

时间:2022-10-13 17:13:25浏览次数:48  
标签:1024 console gunicorn handlers access Unable 报错 error


把logconfig_dict 改为LOGGING解决

logconfig_dict = { 'version':1, 'disable_existing_loggers': False, 'loggers':{ "gunicorn.error": { "level": "DEBUG",# 打日志的等级可以换的,下面的同理 "handlers": ["error_file"], # 对应下面的键 "propagate": 1, "qualname": "gunicorn.error" }, "gunicorn.access": { "level": "DEBUG", "handlers": ["access_file"], "propagate": 0, "qualname": "gunicorn.access" } }, 'handlers':{ "error_file": { "class": "logging.handlers.RotatingFileHandler", "maxBytes": 1024*1024*1024,# 打日志的大小,我这种写法是1个G "backupCount": 1,# 备份多少份,经过测试,最少也要写1,不然控制不住大小 "formatter": "generic",# 对应下面的键 # 'mode': 'w+', "filename": "error.log"# 打日志的路径 }, "access_file": { "class": "logging.handlers.RotatingFileHandler", "maxBytes": 1024*1024*1024, "backupCount": 1, "formatter": "generic", "filename": "access.log", } }, 'formatters':{ "generic": { "format": "'[%(process)d] [%(asctime)s] %(levelname)s [%(filename)s:%(lineno)s] %(message)s'", # 打日志的格式 "datefmt": "[%Y-%m-%d %H:%M:%S %z]",# 时间显示方法 "class": "logging.Formatter" }, "access": { "format": "'[%(process)d] [%(asctime)s] %(levelname)s [%(filename)s:%(lineno)s] %(message)s'", "class": "logging.Formatter" } } }

  

标签:1024,console,gunicorn,handlers,access,Unable,报错,error
From: https://www.cnblogs.com/xu0927/p/16788820.html

相关文章