推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
eailfly
V2EX  ›  Python

logging 的写盘机制是怎样的?按时间还是按大小?

  •  
  •   eailfly · Feb 9, 2015 · 3803 views
    This topic created in 4128 days ago, the information mentioned may be changed or developed.
    因为刚开始用logging,发现经常得停止项目才能把日志写如文件,不知道怎样才能即时写磁盘呢?
    下面是logging的配置:
    5 replies    2015-02-10 06:58:07 +08:00
    Zuckonit
        1
    Zuckonit  
       Feb 9, 2015
    时间, 或者大小都可以自己加handler
    大小是RotatingFileHandler,
    时间的自己查下吧
    sujin190
        2
    sujin190  
       Feb 9, 2015
    每次写完了就flush了,没有缓存
    wangtai
        3
    wangtai  
       Feb 9, 2015
    这是buffer大小的问题吧,和handler无关。
    每次项目停掉才会写磁盘?完全不合理啊,我认为一般不可能出现。这是很严重的bug。
    ryd994
        4
    ryd994  
       Feb 10, 2015
    应该就是即时写或者line buffer而已
    但是文件系统有缓存,所以如果系统崩溃的话可能存不下来
    eailfly
        5
    eailfly  
    OP
       Feb 10, 2015 via Android
    只要是实时就行,可能是buffer的原因,因为会过一段时间写盘,只是我程序跑得时间短,所以老是感觉结束程序才会写盘。
    谢谢各位。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2785 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 09:30 · PVG 17:30 · LAX 02:30 · JFK 05:30
    ♥ Do have faith in what you're doing.