V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2018-06-07 10:17:54 +08:00 · 2263 次点击
    这是一个创建于 2121 天前的主题,其中的信息可能已经有所发展或是发生改变。
    log 同时输出到 StreamHandler
    1. 对于输出到文件后的日志,有什么工具可以过滤等级,时间等查看信息么,类似 androidIDE 中 logcat 的功能,pycharm 里有么,还是有第三方的工具?

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

    谢谢。
    2 条回复    2018-06-07 11:59:26 +08:00
    zhengxiaowai
        1
    zhengxiaowai  
       2018-06-07 10:29:19 +08:00
    1、grep
    2、不用 IDE,不知道怎么看
    corningsun
        2
    corningsun  
       2018-06-07 11:59:26 +08:00
    grep

    过滤日志并写到文件中

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

    可以再结合 sed awk 等,比 logcat 还好使。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2902 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:18 · PVG 23:18 · LAX 08:18 · JFK 11:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.