Revision ff5fac04

b/daemons/ganeti-masterd
391 391
    utils.Daemonize(logfile=constants.LOG_MASTERDAEMON,
392 392
                    noclose_fds=[master.fileno()])
393 393

  
394
  logger.SetupDaemon(constants.LOG_MASTERDAEMON, debug=options.debug)
394
  logger.SetupDaemon(constants.LOG_MASTERDAEMON, debug=options.debug,
395
                     stderr_logging=not options.fork)
395 396

  
396 397
  logging.info("ganeti master daemon startup")
397 398

  
b/daemons/ganeti-noded
633 633
  if options.fork:
634 634
    utils.Daemonize(logfile=constants.LOG_NODESERVER)
635 635

  
636
  logger.SetupDaemon(logfile=constants.LOG_NODESERVER, debug=options.debug)
636
  logger.SetupDaemon(logfile=constants.LOG_NODESERVER, debug=options.debug,
637
                     stderr_logging=not options.fork)
637 638
  logging.info("ganeti node daemon startup")
638 639

  
639 640
  global _EXIT_GANETI_NODED
b/lib/logger.py
84 84
  root_logger.addHandler(stderr_file)
85 85

  
86 86

  
87
def SetupDaemon(logfile, debug=False):
87
def SetupDaemon(logfile, debug=False, stderr_logging=False):
88 88
  """Configures the logging module for daemons
89 89

  
90 90
  """
91 91
  if debug:
92
    fmt = "%(asctime)s: %(levelname)s %(pathname)s:%(lineno)s %(message)s"
92
    fmt = "%(asctime)s: %(levelname)s %(module)s:%(lineno)s %(message)s"
93 93
  else:
94 94
    fmt = "%(asctime)s: %(levelname)s %(message)s"
95 95
  formatter = logging.Formatter(fmt)
......
109 109
  root_logger = logging.getLogger("")
110 110
  root_logger.setLevel(logging.NOTSET)
111 111
  root_logger.addHandler(logfile_handler)
112
  root_logger.addHandler(stderr_handler)
112
  if stderr_logging:
113
    root_logger.addHandler(stderr_handler)
113 114

  
114 115

  
115 116
# Backwards compatibility

Also available in: Unified diff