Vinay Sajip added the comment:
The python-daemon documentation states, about files_preserve:
"Elements of the list are file descriptors (as returned by a file object's
`fileno()` method) or Python `file` objects. Each specifies a file that is not
to be closed during daemon start."
Notice that file objects are just a convenience - filenos() can be passed. The
following, slightly modified script works as expected:
import logging
import logging.handlers
import daemon
logger = logging.getLogger('twitterCounter')
handler = logging.handlers.SysLogHandler(address='/dev/log')
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.info("Hello, ")
with daemon.DaemonContext(files_preserve=[handler.socket.fileno()]):
logger.info("world!")
Output in syslog after running the above:
May 16 10:58:42 eta-oneiric64 Hello,
May 16 10:58:42 eta-oneiric64 world!
----------
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17981>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com