# HG changeset patch # User Goffi # Date 1408580064 -7200 # Node ID ee450d7c88a7ff5ad500444ab94b8258b6b9a929 # Parent b56374a1f6d6d8e4f18a85d21a922e52bab11e5c core (logging): logging is added to stdout in nodaemon mode (it was already the case in debug mode) diff -r b56374a1f6d6 -r ee450d7c88a7 src/core/log_config.py --- a/src/core/log_config.py Wed Aug 20 23:45:21 2014 +0200 +++ b/src/core/log_config.py Thu Aug 21 02:14:24 2014 +0200 @@ -187,10 +187,15 @@ addObserver = self.twisted_log.addObserver if C.LOG_OPT_OUTPUT_DEFAULT in log.handlers: - # default output is already managed, we just add output to stdout if we are in debug mode - from twisted.internet import defer - if defer.Deferred.debug: - addObserver(self.twisted_log.FileLogObserver(sys.stdout).emit) + # default output is already managed, we just add output to stdout if we are in debug or nodaemon mode + + # XXX: this hack is to know if we are in debug or nodaemon mode + # any better method welcomed + from twisted.scripts import twistd + options = twistd.ServerOptions() + options.parseOptions() + if options.get('nodaemon', False) or options.get('debug', False): + addObserver(self.twisted_log.FileLogObserver(sys.stdout).emit) else: # \\default is not in the output, so we remove current observers self.cleared_observers = self.log_publisher.observers