如何从celery任务中释放日志

时间:2015-07-23 19:17:47

标签: django logging celery

我有一个使用call_command调用django管理命令的芹菜任务,该管理命令使用python日志框架创建TimedRotatingFileHandler

在Windows测试站上,我得到以下堆栈跟踪,这似乎表明芹菜任务在完成后仍然保持日志文件句柄打开:

Traceback (most recent call last):
  File "C:\Python27\lib\logging\handlers.py", line 77, in emit
    self.doRollover()
  File "C:\Python27\lib\logging\handlers.py", line 350, in doRollover
    os.rename(self.baseFilename, dfn)
  WindowsError: [Error 32] The process cannot access the file because it is being used by another process
  Logged from file myCommand.py, line XX

这是一个已知的问题,如果有的话,有办法解决它吗? (我试过谷歌搜索但找不到相关的东西)。

0 个答案:

没有答案