Windows 8上的Python日志记录:IOError Errno 22

时间:2015-02-18 15:00:30

标签: python windows logging

我在Windows 8系统上遇到这个非常奇怪的问题:我使用python标准日志库将大量数据记录到RotatingFileHandler。前几条消息没问题(约400行日志),之后我收到以下错误并且不再写日志:

enter image description here

系统和设置信息:

  • Windows 8(无法在Windows 7上复制错误)
  • Python 2.7.6
  • 日志文件位置:网络驱动器上的路径
  • 每秒约1个日志条目
  • 总共约3500个日志条目(对于1次运行的脚本)
  • 记录配置:

     LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'simple': {
                'format': '%(asctime)s %(name)-25s %(levelname)-8s %(message)s',
                'datefmt': '%H:%M:%S',
            },
        },
        'handlers': {
            'log_file': {
                'level': 'DEBUG',
                'class': 'logging.handlers.RotatingFileHandler',
                'filename': 'meastool.log',
                'maxBytes': 1000000,  # ~ 1MB
                'backupCount': 2,
                'formatter': 'simple',
            },
        },
        'loggers': {
            '': {
                'handlers': ['log_file'],
                'propagate': True,
                'level': 'DEBUG',
            },
        }
    }
    

0 个答案:

没有答案