Resurrect logdir option.
This commit is contained in:
@@ -282,6 +282,8 @@ DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger')
|
||||
|
||||
DEFINE_string('state_path', os.path.join(os.path.dirname(__file__), '../'),
|
||||
"Top-level directory for maintaining nova's state")
|
||||
DEFINE_string('logdir', None, 'output to a per-service log file in named '
|
||||
'directory')
|
||||
|
||||
DEFINE_string('sql_connection',
|
||||
'sqlite:///$state_path/nova.sqlite',
|
||||
|
11
nova/log.py
11
nova/log.py
@@ -28,9 +28,11 @@ It also allows setting of formatting information through flags.
|
||||
|
||||
|
||||
import cStringIO
|
||||
import inspect
|
||||
import json
|
||||
import logging
|
||||
import logging.handlers
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
@@ -123,8 +125,13 @@ def basicConfig():
|
||||
syslog = SysLogHandler(address='/dev/log')
|
||||
syslog.setFormatter(_formatter)
|
||||
logging.root.addHandler(syslog)
|
||||
if FLAGS.logfile:
|
||||
logfile = FileHandler(FLAGS.logfile)
|
||||
if FLAGS.logfile or FLAGS.logdir:
|
||||
if FLAGS.logfile:
|
||||
logfile = FLAGS.logfile
|
||||
else:
|
||||
binary = os.path.basename(inspect.stack()[-1][1])
|
||||
logpath = '%s.log' % (os.path.join(FLAGS.logdir, binary),)
|
||||
logfile = FileHandler(logpath)
|
||||
logfile.setFormatter(_formatter)
|
||||
logging.root.addHandler(logfile)
|
||||
|
||||
|
@@ -43,8 +43,6 @@ else:
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DEFINE_string('logdir', None, 'directory to keep log files in '
|
||||
'(will be prepended to $logfile)')
|
||||
|
||||
|
||||
class TwistdServerOptions(ServerOptions):
|
||||
|
Reference in New Issue
Block a user