Reputation: 2248
I'm serving a BottlePy App with CherryPy like this:
import cherrypy
from myapp import MyApp
from beaker.middleware import SessionMiddleware
appdir = '/path/to/app'
app = MyApp(appdir)
session_opts = {
'session.timeout': 600, # 10 minutes
'session.type': 'file',
'session.auto': True,
'session.data_dir': appdir + '/auth/data'
}
app = SessionMiddleware(app, session_opts)
cherrypy.tree.graft(app, '/')
cherrypy.config.update({
'log.screen': False,
'log.access_file': appdir + '/front_end/cherrypy.access.log',
'log.error_file': appdir + '/front_end/cherrypy.error.log',
'server.socket_port': 8080,
'server.socket_host': '0.0.0.0'
})
cherrypy.engine.start()
cherrypy.engine.block()
Everything seems to be working properly, but cherrypy.access.log
remains totally empty, while cherrypy.error.log
reads:
[30/Dec/2014:11:04:55] ENGINE Bus STARTING
[30/Dec/2014:11:04:55] ENGINE Started monitor thread '_TimeoutMonitor'.
[30/Dec/2014:11:04:55] ENGINE Started monitor thread 'Autoreloader'.
[30/Dec/2014:11:04:56] ENGINE Serving on http://0.0.0.0:8080
[30/Dec/2014:11:04:56] ENGINE Bus STARTED
But nothing else, no access logs, even after serving content.
I also tried
from cherrypy import wsgiserver
# Instead of the cherrypy.* calls
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 8080), app)
server.start()
but it will print the same as above, but no access logs. Could not find any further documentation on logging and BottlePy integration.
Upvotes: 2
Views: 692
Reputation: 2009
The app you're running is not native CherryPy one, and graft
ing basically bypasses most of CP's internals, most likely including access logging.
Since you don't use any CherryPy's features besides basic WSGI publishing, you may be better off using one of the more serving-oriented (and more recent) solutions like uWSGI, Gunicorn or nginx/Apache+plugins.
Upvotes: 2
Reputation: 300
You need to set log.screen
to True
to enable both error and access logs.
See (old) docs: https://cherrypy.readthedocs.org/en/3.3.0/refman/_cplogging.html
Upvotes: 0