Revision d21d09d6
b/daemons/ganeti-masterd | ||
---|---|---|
149 | 149 |
while True: |
150 | 150 |
msg = self.read_message() |
151 | 151 |
if msg is None: |
152 |
logging.info("client closed connection")
|
|
152 |
logging.debug("client closed connection")
|
|
153 | 153 |
break |
154 | 154 |
|
155 | 155 |
request = simplejson.loads(msg) |
... | ... | |
468 | 468 |
utils.WritePidFile(constants.MASTERD_PID) |
469 | 469 |
try: |
470 | 470 |
utils.SetupLogging(constants.LOG_MASTERDAEMON, debug=options.debug, |
471 |
stderr_logging=not options.fork) |
|
471 |
stderr_logging=not options.fork, multithreaded=True)
|
|
472 | 472 |
|
473 | 473 |
logging.info("Ganeti master daemon startup") |
474 | 474 |
|
b/lib/jqueue.py | ||
---|---|---|
344 | 344 |
@param job: the job to be processed |
345 | 345 |
|
346 | 346 |
""" |
347 |
logging.debug("Worker %s processing job %s",
|
|
347 |
logging.info("Worker %s processing job %s",
|
|
348 | 348 |
self.worker_id, job.id) |
349 | 349 |
proc = mcpu.Processor(self.pool.queue.context) |
350 | 350 |
self.queue = queue = job.queue |
... | ... | |
352 | 352 |
try: |
353 | 353 |
count = len(job.ops) |
354 | 354 |
for idx, op in enumerate(job.ops): |
355 |
op_summary = op.input.Summary() |
|
355 | 356 |
try: |
356 |
logging.debug("Op %s/%s: Starting %s", idx + 1, count, op) |
|
357 |
logging.info("Op %s/%s: Starting opcode %s", idx + 1, count, |
|
358 |
op_summary) |
|
357 | 359 |
|
358 | 360 |
queue.acquire() |
359 | 361 |
try: |
... | ... | |
408 | 410 |
finally: |
409 | 411 |
queue.release() |
410 | 412 |
|
411 |
logging.debug("Op %s/%s: Successfully finished %s",
|
|
412 |
idx + 1, count, op)
|
|
413 |
logging.info("Op %s/%s: Successfully finished opcode %s",
|
|
414 |
idx + 1, count, op_summary)
|
|
413 | 415 |
except CancelJob: |
414 | 416 |
# Will be handled further up |
415 | 417 |
raise |
... | ... | |
420 | 422 |
op.status = constants.OP_STATUS_ERROR |
421 | 423 |
op.result = str(err) |
422 | 424 |
op.end_timestamp = TimeStampNow() |
423 |
logging.debug("Op %s/%s: Error in %s", idx + 1, count, op) |
|
425 |
logging.info("Op %s/%s: Error in opcode %s", idx + 1, count, |
|
426 |
op_summary) |
|
424 | 427 |
finally: |
425 | 428 |
queue.UpdateJobUnlocked(job) |
426 | 429 |
finally: |
... | ... | |
449 | 452 |
status = job.CalcStatus() |
450 | 453 |
finally: |
451 | 454 |
queue.release() |
452 |
logging.debug("Worker %s finished job %s, status = %s",
|
|
453 |
self.worker_id, job_id, status)
|
|
455 |
logging.info("Worker %s finished job %s, status = %s",
|
|
456 |
self.worker_id, job_id, status) |
|
454 | 457 |
|
455 | 458 |
|
456 | 459 |
class _JobQueueWorkerPool(workerpool.WorkerPool): |
b/lib/utils.py | ||
---|---|---|
1653 | 1653 |
return port |
1654 | 1654 |
|
1655 | 1655 |
|
1656 |
def SetupLogging(logfile, debug=False, stderr_logging=False, program=""): |
|
1656 |
def SetupLogging(logfile, debug=False, stderr_logging=False, program="", |
|
1657 |
multithreaded=False): |
|
1657 | 1658 |
"""Configures the logging module. |
1658 | 1659 |
|
1659 | 1660 |
@type logfile: str |
... | ... | |
1665 | 1666 |
@param stderr_logging: whether we should also log to the standard error |
1666 | 1667 |
@type program: str |
1667 | 1668 |
@param program: the name under which we should log messages |
1669 |
@type multithreaded: boolean |
|
1670 |
@param multithreaded: if True, will add the thread name to the log file |
|
1668 | 1671 |
@raise EnvironmentError: if we can't open the log file and |
1669 | 1672 |
stderr logging is disabled |
1670 | 1673 |
|
1671 | 1674 |
""" |
1672 |
fmt = "%(asctime)s: " + program + " " |
|
1675 |
fmt = "%(asctime)s: " + program + " pid=%(process)d" |
|
1676 |
if multithreaded: |
|
1677 |
fmt += "/%(threadName)s" |
|
1673 | 1678 |
if debug: |
1674 |
fmt += ("pid=%(process)d/%(threadName)s %(levelname)s" |
|
1675 |
" %(module)s:%(lineno)s %(message)s") |
|
1676 |
else: |
|
1677 |
fmt += "pid=%(process)d %(levelname)s %(message)s" |
|
1679 |
fmt += " %(module)s:%(lineno)s" |
|
1680 |
fmt += " %(levelname)s %(message)s" |
|
1678 | 1681 |
formatter = logging.Formatter(fmt) |
1679 | 1682 |
|
1680 | 1683 |
root_logger = logging.getLogger("") |
... | ... | |
1706 | 1709 |
else: |
1707 | 1710 |
logfile_handler.setLevel(logging.INFO) |
1708 | 1711 |
root_logger.addHandler(logfile_handler) |
1709 |
except EnvironmentError, err:
|
|
1712 |
except EnvironmentError: |
|
1710 | 1713 |
if stderr_logging: |
1711 | 1714 |
logging.exception("Failed to enable logging to file '%s'", logfile) |
1712 | 1715 |
else: |
Also available in: Unified diff