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

使用 apache 部署 flask 的时候,print 到哪里了?

  •  
  •   jxwho · Aug 12, 2014 · 7704 views
    This topic created in 4437 days ago, the information mentioned may be changed or developed.
    一开始可以在/var/log/apache2/error.log看到,后来变成了只有系统错误才看到,自定义的print不知道去哪里了。
    求解。。。
    谢谢!
    9 replies  •  2014-08-13 09:36:10 +08:00
    ritksm
        1
    ritksm  
       Aug 12, 2014
    harrychinese
        2
    harrychinese  
       Aug 12, 2014 via Android
    自然消失的无影无踪,用日志吧。flask教程中有一个日志使用方法,看看即会
    holsety
        3
    holsety  
       Aug 12, 2014
    import logging, sys, os
    logging.basicConfig(stream=sys.stderr)

    试试这个.
    jxwho
        4
    jxwho  
    OP
       Aug 12, 2014
    @ritksm
    @harrychinese 好的谢谢~~
    @holsety 我设置了这个了,但是,去哪里了?
    julyclyde
        5
    julyclyde  
       Aug 12, 2014
    apache部署?mod_wsgi么?
    jxwho
        6
    jxwho  
    OP
       Aug 12, 2014 via iPhone
    @julyclyde 是呀
    yueyoum
        7
    yueyoum  
       Aug 12, 2014
    找你配置的 python environment 的 stdout
    mengzhuo
        8
    mengzhuo  
       Aug 13, 2014
    @jxwho

    杜绝print
    可能要设定低level
    logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
    jxwho
        9
    jxwho  
    OP
       Aug 13, 2014 via iPhone
    @mengzhuo 要用flak.logger?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2452 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 14:28 · PVG 22:28 · LAX 07:28 · JFK 10:28
    ♥ Do have faith in what you're doing.