为什么cherrypy服务器会记录错误消息,即使它似乎有效?

时间:2017-12-06 13:31:29

标签: python cherrypy

我正在使用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()

2 个答案:

答案 0 :(得分:1)

您在日志文件中看到的内容绝对没有错。当我运行Cherrypy时,我看到相同的总线和服务语句。我猜Cherrypy避风港真的没用过“错误”这个词。在那里效率太高,就像有些人称之为HTTP状态代码'错误代码',实际上代码200意味着一切都很好。

答案 1 :(得分:0)

我认为对于你的情况,监听器(用于活动记录)基本上与cherrypy / __ init__.py中的函数_buslog连接,并且它们最终将在cherrypy / _cplogging.py中调用函数error()。 并根据那里的描述:

 """ 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``.
"""

所以,是的,这不仅仅是因为错误......