【发布时间】:2018-03-11 01:27:00
【问题描述】:
我正在使用最新的bandersnatch 2.0.0 和 python 3.5 来创建 PyPi 镜像。 Bandersnatch 有一些相当稀疏的文档,但在示例配置文件中,它说:
; Advanced logging configuration. Uncomment and set to the location of a
; python logging format logging config file.
; log-config = /etc/bandersnatch-log.conf
所以我已经准备好 python 日志配置,取消注释上面的行并创建了这个日志配置:
[loggers]
keys=root
[handlers]
keys=logfile
[formatters]
keys=logfileformatter
[logger_root]
level=NOTSET
handlers=logfile
[formatter_logfileformatter]
format=%(asctime)s %(name)-12s: %(levelname)s %(message)s
[handler_logfile]
class=handlers.RotatingFileHandler
level=DEBUG
formatter=logfileformatter
args=('/path/to/bandersnatch.log','a',10485760,5)
现在 bandersnatch 不再向 stdout 产生任何输出,并且我指定的日志文件已创建,但没有记录任何内容。
我已经为指定的两个日志级别尝试了不同的 NOTSET 和 DEBUG 组合,但是当我运行 bandersnatch 时还没有记录任何内容。
有什么想法吗?例如,我看到的所有其他问题都是编程错误或人们忘记为 [logger_root] 设置日志级别。我想我没有错过任何这些。
【问题讨论】:
标签: python logging python-3.5