Python 2.7

时间:2018-04-24 03:56:31

标签: python-2.7 logging config

我正在尝试使用一个软件(Quillpad),由于以下原因无法编译:

File "startquill_cherry.py", line 31, in <module>
    logging.config.fileConfig('logsystem.conf')
  File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
    handlers = _install_handlers(cp, formatters)
  File "/usr/lib/python2.7/logging/config.py", line 163, in _install_handlers
    h = klass(*args)
  File "/usr/lib/python2.7/logging/__init__.py", line 913, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 943, in _open
    stream = open(self.baseFilename, self.mode)

IOError: [Errno 2] No such file or directory: 'mydir/logs/root.log'

此错误由startquill_cherry.py文件中的以下代码触发:

logging.config.fileConfig('logsystem.conf')
logger = logging.getLogger('quillpad')

logsystem.conf中的相关代码(我认为)如下:

[loggers]
keys=root,datacollector,mailcollector

[logger_root]
level=INFO
handlers=default

[handler_default]
class=FileHandler
level=INFO
formatter=default
args=('logs/quill.log', 'a')

对此有何想法?我真的不明白Python 2.7中的配置文件是如何工作的。我能够通过注释掉Python代码来编译程序,但最终会导致另一个错误。

0 个答案:

没有答案