How to debug/log wsgi python app?

前端 未结 1 1813
野的像风
野的像风 2021-01-13 07:16

I tried this:

#!/usr/bin/python    

from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
import logging
import os
import sys

html         


        
1条回答
  •  伪装坚强ぢ
    2021-01-13 07:55

    Note that the above code won't actually produce any log whatsoever since your not calling any of the logger.log() variants - but I guess that's not the point.

    If you're running your code with apache/mod_wsgi, the simplest solution is to configure your logger(s) to log to sys.stderr using a StreamHandler (cf http://docs.python.org/howto/logging.html#configuring-logging), and define the error log path, name and level in your apache conf (beware, the default apache behaviour is to only log "error level" message).

    0 讨论(0)
提交回复
热议问题