为什么 cherrypy 服务器记录错误消息,即使它似乎可以工作?
Why cherrypy server logs error messages even though it seems to work?
我正在使用 cherrypy 启动服务器,它的计算引擎是 Apache Spark。它记录了这个奇怪的结果:
[06/Dec/2017:13:25:42] ENGINE Bus STARTING
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Bus STARTING
[06/Dec/2017:13:25:42] ENGINE Started monitor thread 'Autoreloader'.
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Started monitor thread 'Autoreloader'.
[06/Dec/2017:13:25:42] ENGINE Serving on http://0.0.0.0:5432
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Serving on http://0.0.0.0:5432
[06/Dec/2017:13:25:42] ENGINE Bus STARTED
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Bus STARTED
我的问题是,INFO:cherrypy.error:
它记录的是什么?
这就是我 运行 服务器的方式:
def run_server(app):
# Enable WSGI access logging via Paste
app_logged = TransLogger(app)
# Mount the WSGI callable object (app) on the root directory
cherrypy.tree.graft(app_logged, '/')
# Set the configuration of the web server
cherrypy.config.update({
'engine.autoreload.on': True,
'log.screen': True,
'server.socket_port': 5432,
'server.socket_host': '0.0.0.0'
})
# Start the CherryPy WSGI web server
cherrypy.engine.start()
cherrypy.engine.block()
您在日志文件中看到的完全没有问题。当我 运行 Cherrypy 时,我看到相同的总线和服务语句。我猜 Cherrypy 并没有真正有效地使用术语 'error',就像有些人称 HTTP 状态代码为 'error codes',而实际上代码 200 意味着一切都很好。
我认为对于你的情况,侦听器(用于活动日志记录)基本上与 cherrypy/__ init__.py 中的函数 _buslog 连接,并且它们最终将调用 [= 中的函数 error() 17=].py
根据那里的描述:
""" Write the given ``msg`` to the error log.
This is not just for errors! Applications may call this at any time
to log application-specific information.
If ``traceback`` is True, the traceback of the current exception
(if any) will be appended to ``msg``.
"""
所以,是的,这不仅仅是为了错误...
我正在使用 cherrypy 启动服务器,它的计算引擎是 Apache Spark。它记录了这个奇怪的结果:
[06/Dec/2017:13:25:42] ENGINE Bus STARTING
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Bus STARTING
[06/Dec/2017:13:25:42] ENGINE Started monitor thread 'Autoreloader'.
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Started monitor thread 'Autoreloader'.
[06/Dec/2017:13:25:42] ENGINE Serving on http://0.0.0.0:5432
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Serving on http://0.0.0.0:5432
[06/Dec/2017:13:25:42] ENGINE Bus STARTED
INFO:cherrypy.error:[06/Dec/2017:13:25:42] ENGINE Bus STARTED
我的问题是,INFO:cherrypy.error:
它记录的是什么?
这就是我 运行 服务器的方式:
def run_server(app):
# Enable WSGI access logging via Paste
app_logged = TransLogger(app)
# Mount the WSGI callable object (app) on the root directory
cherrypy.tree.graft(app_logged, '/')
# Set the configuration of the web server
cherrypy.config.update({
'engine.autoreload.on': True,
'log.screen': True,
'server.socket_port': 5432,
'server.socket_host': '0.0.0.0'
})
# Start the CherryPy WSGI web server
cherrypy.engine.start()
cherrypy.engine.block()
您在日志文件中看到的完全没有问题。当我 运行 Cherrypy 时,我看到相同的总线和服务语句。我猜 Cherrypy 并没有真正有效地使用术语 'error',就像有些人称 HTTP 状态代码为 'error codes',而实际上代码 200 意味着一切都很好。
我认为对于你的情况,侦听器(用于活动日志记录)基本上与 cherrypy/__ init__.py 中的函数 _buslog 连接,并且它们最终将调用 [= 中的函数 error() 17=].py 根据那里的描述:
""" Write the given ``msg`` to the error log. This is not just for errors! Applications may call this at any time to log application-specific information. If ``traceback`` is True, the traceback of the current exception (if any) will be appended to ``msg``. """
所以,是的,这不仅仅是为了错误...