Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Cherrypy Access Log Rotation

If I want the access log for Cherrypy to only get to a fixed size, how would I go about using rotating log files?

I've already tried http://www.cherrypy.org/wiki/Logging, which seems out of date, or has information missing.

like image 671
williamtroup Avatar asked Dec 18 '22 05:12

williamtroup


2 Answers

Look at http://docs.python.org/library/logging.html.

You probably want to configure a RotatingFileHandler

http://docs.python.org/library/logging.html#rotatingfilehandler

like image 62
S.Lott Avatar answered Jan 03 '23 12:01

S.Lott


I've already tried http://www.cherrypy.org/wiki/Logging, which seems out of date, or has information missing.

Try adding:

import logging
import logging.handlers
import cherrypy # you might have imported this already

and instead of

log = app.log

maybe try

log = cherrypy.log
like image 24
e1i45 Avatar answered Jan 03 '23 11:01

e1i45