This is how I run the daemon:
import daemon
logger = logging.getLogger('time_logging_daemon')
handler = logging.handlers.SysLogHandler(
facility=logging.handlers.SysLogHandler.LOG_DAEMON, address="/dev/log")
logger.addHandler(handler)
logger.setLevel(logging.INFO)
logger.info("Before")
with daemon.DaemonContext():
logger.info("Before daemonizing.")
try:
bot.start()
except:
logger.info("crashed")
Unfortunately all I get in the logs is this:
Apr 3 22:33:06 mybot Before daemonizing.
It doesn't seem to be crashing, and I can see it in ps aux | grep python
.
But the code just doesn't function as its supposed to be. How can errors be thrown and captured, so I can see if anything isn't right?