Hello all!
I'm running CherryPy from supervisor, so supervisor handles log file
rotation for the CherryPy output. With CherryPy-3.1.0beta3 this worked
flawlessly: The access log got written to stdout and all errors and
custom logging got written to stderr. But now after updating to
CherryPy-3.1.0 everything seems to get logged to stderr. Here's the
script I use for testing this:
import os, optparse
import cherrypy
@cherrypy.expose
def search(phrase):
cherrypy.log(phrase)
return phrase
cherrypy.tree.mount(search, script_name="/search")
def main(args=None):
debug = 0
port = 8000
threads = 10
p = optparse.OptionParser(usage="usage: %prog [options]")
p.add_option("--debug", dest="debug", help="debug mode (0 or 1;
default %default)", type="int", default=debug)
p.add_option("--port", dest="port", help="port (default
%default)", type="int", default=port)
p.add_option("--threads", dest="threads", help="number of threads
(non-debug mode only; default %default)", type="int", default=threads)
(options, args) = p.parse_args(args)
if len(args) != 0:
p.error("incorrect number of arguments")
sys.exit(1)
configmap = {
"server.socket_host": "0.0.0.0",
"server.socket_port": options.port,
"server.screen": True,
}
if options.debug:
configmap["server.environment"] = "development"
else:
configmap["server.environment"] = "production"
configmap["server.thread_pool"] = options.threads
cherrypy.config.update(configmap)
cherrypy.engine.start()
if __name__ == "__main__":
main()
When I start this script with:
python foo.py >stdout.txt 2>stderr.txt
stdout.txt remains empty and stderr.txt contains all the logging
output:
[02/Sep/2008:20:27:04] ENGINE Started monitor thread
'_TimeoutMonitor'.
[02/Sep/2008:20:27:04] ENGINE Started monitor thread 'Autoreloader'.
[02/Sep/2008:20:27:04] ENGINE Serving on
0.0.0.0:8000
[02/Sep/2008:20:27:04] ENGINE Bus STARTED
[02/Sep/2008:20:27:16] foo
127.0.0.1 - - [02/Sep/2008:20:27:16] "GET /search/foo HTTP/1.1" 200 3
"" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1)
Gecko/2008070206 Firefox/3.0.1"
How can I get the old behaviour back (access log to stdout, everything
else to stderr)?
Servus,
Walter