thesharp / daemonize

daemonize is a library for writing system daemons in Python.
MIT License
445 stars 64 forks source link

in foreground mode, logging is still done to the syslog #65

Open whot opened 6 years ago

whot commented 6 years ago

This is as of commit 9018be

By default, daemonize inits a logger to syslog, catches any exceptions and writes them to that logger. That's useful in daemon mode but it also does so when in foreground mode - with the odd behaviour that anything the application prints normally ends up on stdout/stderr but any exception is only printed to syslog. This makes debugging harder and is quite confusing to those that expect an exception.

IMO the behaviour for the logger should either be if self.logger is None and not self.foreground or the propagation should be to stdout/stderr as well in foreground mode.