Dimitris Poulopoulos
Dimitris Poulopoulos

Reputation: 1159

Why cherrypy server logs error messages even though it seems to work?

I'm using cherrypy to start a server, that its computation engine is Apache Spark. It logs this weird result:

[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

My question is, what is this INFO:cherrypy.error: it logs?

This is how I run the server:

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()

Upvotes: 1

Views: 1545

Answers (2)

JoeyZhao
JoeyZhao

Reputation: 533

I think for your case, the listeners (for activities logging) are essentially wired with the function _buslog in cherrypy/__ init__.py , and they eventually will call the function error() in cherrypy/_cplogging.py and according to the description there:

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

So , yeah, this is not just for errors...

Upvotes: 0

MRichards
MRichards

Reputation: 86

There's absolutely nothing wrong with what you're seeing in the log file. I see the same bus and serving statements when I run Cherrypy. I guess Cherrypy haven't really used the term 'error' too effectively there, like some people call the HTTP status codes 'error codes', when in fact code 200 means everything is all good.

Upvotes: 1

Related Questions