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

几个 logging 日志的查看问题

  •  
  •   smdbh · Jun 7, 2018 · 3186 views
    This topic created in 3041 days ago, the information mentioned may be changed or developed.
    log 同时输出到 StreamHandler
    1. 对于输出到文件后的日志,有什么工具可以过滤等级,时间等查看信息么,类似 androidIDE 中 logcat 的功能,pycharm 里有么,还是有第三方的工具?

    2. 在 pycharm 里,没有之前的格式化信息,例如时间,等级等

    谢谢。
    2 replies  •  2018-06-07 11:59:26 +08:00
    zhengxiaowai
        1
    zhengxiaowai  
       Jun 7, 2018
    1、grep
    2、不用 IDE,不知道怎么看
    corningsun
        2
    corningsun  
       Jun 7, 2018
    grep

    过滤日志并写到文件中

    `grep '需要的信息' xxx.log -A 100 | grep -V '忽略的信息' > result.log`

    可以再结合 sed awk 等,比 logcat 还好使。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2241 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 05:51 · PVG 13:51 · LAX 22:51 · JFK 01:51
    ♥ Do have faith in what you're doing.