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

关于 logger 的问题

  •  
  •   ray1888 ·
    ray1888 · Oct 22, 2017 · 3122 views
    This topic created in 3169 days ago, the information mentioned may be changed or developed.

    现在自己在写一个项目,有一个主入口模块和其他的功能模块(每个模块为单独的一个 python 文件),请问一下,有什么方法能把日志打印到同一个文件输出呢?之前只试过对每个 py 文件单独打一个 log,没试过这么多模块来进行输出到一个日志里面,求解答

    4 replies    2017-10-22 21:56:03 +08:00
    supersu
        2
    supersu  
       Oct 22, 2017 via Android
    初始化 logger 的时候日志文件名指定好呀,可以参考一下这个项目中的这个模块有用到 logging 库,所有的日志都写在同一个文件里面 https://github.com/supersu097/mycrawler/blob/master/core/helper.py
    dayinfinte
        3
    dayinfinte  
       Oct 22, 2017
    同样有个问题,就是怎么样将项目中的不同级别的日志打到不同的文件中
    ray1888
        4
    ray1888  
    OP
       Oct 22, 2017
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3558 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 04:43 · PVG 12:43 · LAX 21:43 · JFK 00:43
    ♥ Do have faith in what you're doing.