推荐学习书目
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
qwefdrt
V2EX  ›  Python

Python 用 with open ... write 写日志有什么弊端?和 logging 比?

  •  
  •   qwefdrt · Dec 20, 2018 · 3214 views
    This topic created in 2713 days ago, the information mentioned may be changed or developed.
    8 replies    2018-12-21 09:18:03 +08:00
    likuku
        1
    likuku  
       Dec 20, 2018
    精力时间挥洒不完,那就自己造轮子;否则,直接用轮子。
    reself
        2
    reself  
       Dec 20, 2018 via Android
    原子性了解一下,异步了解一下,日志收集器了解一下
    cdwyd
        3
    cdwyd  
       Dec 20, 2018 via Android
    一般小项目直接用就是了
    lihongjie0209
        4
    lihongjie0209  
       Dec 20, 2018
    大量日志直接卡死, 还有这么解决并发问题? 怎么适配不同的 appender?
    C0VN
        5
    C0VN  
       Dec 20, 2018
    啊,write 写文件为什么直接 print,然后 shell 里面重定向到文件。
    chengxiao
        6
    chengxiao  
       Dec 20, 2018
    分文件怎么整?按日期 write 文件么?
    还有如果真这样的话不如直接输出命令行 >> xxx.log
    BingoXuan
        7
    BingoXuan  
       Dec 20, 2018
    我们也是这么操作的。但是不同的是,我们单独开了进程写 log。log 进程订阅其他进程发布的消息,然后将消息写入日志中。但麻烦的是,找日志会找死人。。。
    quinoa42
        8
    quinoa42  
       Dec 21, 2018
    你要是想 log 到 stderr 怎么办?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6026 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 02:58 · PVG 10:58 · LAX 19:58 · JFK 22:58
    ♥ Do have faith in what you're doing.