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

问题描述 投票:1回答:2

我正在使用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()
python cherrypy
2个回答
1
投票

您在日志文件中看到的内容绝对没有错。当我运行Cherrypy时,我看到相同的总线和服务语句。我猜Cherrypy并没有真正有效地使用术语“错误”,就像有些人称之为HTTP状态代码'错误代码',实际上代码200意味着一切都很好。


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

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

© www.soinside.com 2019 - 2024. All rights reserved.