[英]Logging in web2py
I'm working on a web application that handles a bit of traffic. 我正在处理一些流量的Web应用程序。 I tried using FileHandler, set up when handling each request, for logging but that resulted in wsgi crashing from too many open files, current limit is 1024 which seems reasonable.
我尝试使用FileHandler(在处理每个请求时进行设置)进行记录,但是这导致wsgi因太多打开的文件而崩溃,当前限制为1024,这似乎是合理的。
How do people handle logging when dealing with a bit of traffic? 人们在处理少量流量时如何处理日志记录? Is there a way for the wsgi process to use one filehandle for all requests?
wsgi进程是否可以对所有请求使用一个文件句柄?
Python comes with a sufficient logger that should handle many requests at once. Python附带了一个足够的记录器,该记录器应一次处理许多请求。
For example: 例如:
import logging
logger = logging.getLogger("web2py.app.myweb2pyapplication")
logger.setLevel(logging.DEBUG)
Then, in your code: 然后,在您的代码中:
logger.error("Something went wrong! Error:"+str(e)
or 要么
logger.debug("Still trying to figure this out. Checkpoint 3")
Python logging: http://docs.python.org/2/library/logging.html Python记录: http : //docs.python.org/2/library/logging.html
If this doesn't suit your needs, more advanced logging is available here: http://www.web2pyslices.com/slice/show/1416/logging 如果这不适合您的需求,请在此处提供更高级的日志记录: http : //www.web2pyslices.com/slice/show/1416/logging
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.