python logging模塊“另一個程序正在使用此文件,進程無法訪問。”問題解決辦法


在多進程下使用python的logging模塊,經常會遇到“另一個程序正在使用此文件,進程無法訪問。”的錯誤。

解決辦法: https://github.com/Preston-Landers/concurrent-log-handler

To use this module from a logging config file, use a handler entry like this:
  file:
    class: concurrent_log_handler.ConcurrentRotatingFileHandler
    level: DEBUG
    formatter: simple
    filename: ./logs/tornado_proj.log
    encoding: utf8  
Note: you must have a "import concurrent_log_handler" before you call fileConfig(). For more information see http://docs.python.org/lib/logging-config-fileformat.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM