#646: logging breaks when running as daemon
------------------------------------------+---------------------------------
Reporter: walter AT livinglogic DOT de | Owner: rdelon
Type: defect | Status: new
Priority: normal | Milestone:
Component: CherryPy code | Keywords:
------------------------------------------+---------------------------------
I'm trying to run my CherryPy server as a daemon process (using ll.daemon
available from
http://www.livinglogic.de/Python/daemon/). With CherryPy
2.2.1 this worked flawlessly. 3.0 however is giving me problems. Here is a
small test script that demonstrates the bug:
{{{
import os
import cherrypy
from ll import daemon
cherrypy.config.update(
{
"server.environment": "production",
"server.socket_port": 9999,
"server.thread_pool": 10,
"server.log_to_screen": 0,
"server.log_file": "/home/walter/cherrylogs/wiki.error",
"server.log_access_file":
"/home/walter/cherrylogs/wiki.access",
}
)
if __name__ == "__main__":
d = daemon.Daemon(
pidfile="/var/run/walter/wiki.pid",
user="walter",
group="users",
)
if d.service():
cherrypy.quickstart(lambda n: "foo", "/")
}}}
Here is the stacktrace I'm getting:
{{{
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python2.5/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.5/logging/__init__.py", line 1351, in
shutdown
h.flush()
File "/usr/local/lib/python2.5/logging/__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/local/lib/python2.5/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.5/logging/__init__.py", line 1351, in
shutdown
h.flush()
File "/usr/local/lib/python2.5/logging/__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python2.5/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.5/logging/__init__.py", line 1351, in
shutdown
h.flush()
File "/usr/local/lib/python2.5/logging/__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/local/lib/python2.5/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/local/lib/python2.5/logging/__init__.py", line 1351, in
shutdown
h.flush()
File "/usr/local/lib/python2.5/logging/__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file
}}}
--
Ticket URL: <
http://www.cherrypy.org/ticket/646>
CherryPy <
http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework