Revision cfcc79c6

b/lib/cli.py
1913 1913
    for key, val in override.iteritems():
1914 1914
      setattr(options, key, val)
1915 1915

  
1916
  utils.SetupLogging(constants.LOG_COMMANDS, debug=options.debug,
1917
                     stderr_logging=True, program=binary)
1916
  utils.SetupLogging(constants.LOG_COMMANDS, binary, debug=options.debug,
1917
                     stderr_logging=True)
1918 1918

  
1919 1919
  if old_cmdline:
1920 1920
    logging.info("run with arguments '%s'", old_cmdline)
b/lib/daemon.py
659 659
  utils.WritePidFile(utils.DaemonPidFileName(daemon_name))
660 660
  try:
661 661
    try:
662
      utils.SetupLogging(logfile=constants.DAEMONS_LOGFILES[daemon_name],
662
      utils.SetupLogging(constants.DAEMONS_LOGFILES[daemon_name], daemon_name,
663 663
                         debug=options.debug,
664 664
                         stderr_logging=not options.fork,
665 665
                         multithreaded=multithreaded,
666
                         program=daemon_name,
667 666
                         syslog=options.syslog,
668 667
                         console_logging=console_logging)
669 668
      if callable(prepare_fn):
b/lib/utils/log.py
22 22

  
23 23
"""
24 24

  
25
import os.path
25 26
import logging
26 27
import logging.handlers
27 28

  
......
162 163
  return logging.Formatter("".join(parts))
163 164

  
164 165

  
165
def SetupLogging(logfile, debug=0, stderr_logging=False, program="",
166
def SetupLogging(logfile, program, debug=0, stderr_logging=False,
166 167
                 multithreaded=False, syslog=constants.SYSLOG_USAGE,
167 168
                 console_logging=False):
168 169
  """Configures the logging module.
169 170

  
170 171
  @type logfile: str
171 172
  @param logfile: the filename to which we should log
173
  @type program: str
174
  @param program: the name under which we should log messages
172 175
  @type debug: integer
173 176
  @param debug: if greater than zero, enable debug messages, otherwise
174 177
      only those at C{INFO} and above level
175 178
  @type stderr_logging: boolean
176 179
  @param stderr_logging: whether we should also log to the standard error
177
  @type program: str
178
  @param program: the name under which we should log messages
179 180
  @type multithreaded: boolean
180 181
  @param multithreaded: if True, will add the thread name to the log file
181 182
  @type syslog: string
......
190 191
      syslog/stderr logging is disabled
191 192

  
192 193
  """
193
  formatter = _GetLogFormatter(program, multithreaded, debug, False)
194
  syslog_fmt = _GetLogFormatter(program, multithreaded, debug, True)
194
  progname = os.path.basename(program)
195

  
196
  formatter = _GetLogFormatter(progname, multithreaded, debug, False)
197
  syslog_fmt = _GetLogFormatter(progname, multithreaded, debug, True)
195 198

  
196 199
  root_logger = logging.getLogger("")
197 200
  root_logger.setLevel(logging.NOTSET)
b/lib/watcher/__init__.py
32 32
# C0103: Invalid name ganeti-watcher
33 33

  
34 34
import os
35
import os.path
35 36
import sys
36 37
import time
37 38
import logging
......
714 715
    print >> sys.stderr, ("Usage: %s [-f] " % sys.argv[0])
715 716
    return constants.EXIT_FAILURE
716 717

  
717
  utils.SetupLogging(constants.LOG_WATCHER, debug=options.debug,
718
                     stderr_logging=options.debug)
718
  utils.SetupLogging(constants.LOG_WATCHER, sys.argv[0],
719
                     debug=options.debug, stderr_logging=options.debug)
719 720

  
720 721
  if ShouldPause() and not options.ignore_pause:
721 722
    logging.debug("Pause has been set, exiting")
b/tools/burnin
1071 1071
  """Main function.
1072 1072

  
1073 1073
  """
1074
  utils.SetupLogging(constants.LOG_BURNIN, debug=False, stderr_logging=True)
1074
  utils.SetupLogging(constants.LOG_BURNIN, sys.argv[0],
1075
                     debug=False, stderr_logging=True)
1075 1076

  
1076 1077
  return Burner().BurninCluster()
1077 1078

  

Also available in: Unified diff