ryu/log: bugfix
$ ryu-manager --log_file $HOME/ryu.log
Traceback (most recent call last):
(...)
File "/usr/local/lib/python2.7/dist-packages/ryu-1.1-py2.7.egg/ryu/log.py", line 74, in init_log
logging.addHandler(logging.handlers.WatchedFileHandler(log_file))
AttributeError: 'module' object has no attribute 'addHandler'
$ ryu-manager --log_file $HOME/ryu.log
Traceback (most recent call last):
(...)
File "/usr/local/lib/python2.7/dist-packages/ryu-1.4-py2.7.egg/ryu/log.py", line 74, in init_log
log.addHandler(logging.handlers.WatchedFileHandler(log_file))
AttributeError: 'module' object has no attribute 'handlers'
$ ryu-manager --log_file $HOME/ryu.log
Traceback (most recent call last):
(...)
File "/usr/local/lib/python2.7/dist-packages/ryu-1.4-py2.7.egg/ryu/log.py", line 76, in init_log
mode = int(FLAGS.log_file_mnode, 8)
File "/usr/local/lib/python2.7/dist-packages/gflags.py", line 810, in __getattr__
raise AttributeError(name)
AttributeError: log_file_mnode
$ ryu-manager --log_dir $HOME/log/
Traceback (most recent call last):
(...)
File "/usr/local/lib/python2.7/dist-packages/ryu-1.4-py2.7.egg/ryu/log.py", line 54, in _get_log_file
return os.path.join(FLAGS.logdir,
File "/usr/local/lib/python2.7/dist-packages/gflags.py", line 810, in __getattr__
raise AttributeError(name)
AttributeError: logdir
Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
committed by
FUJITA Tomonori
parent
c7d4aa7475
commit
c5c7dc9cfe
@@ -17,6 +17,7 @@
|
||||
import gflags
|
||||
import inspect
|
||||
import logging
|
||||
import logging.handlers
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -50,7 +51,7 @@ def _get_log_file():
|
||||
if FLAGS.log_file:
|
||||
return FLAGS.log_file
|
||||
if FLAGS.log_dir:
|
||||
return os.path.join(FLAGS.logdir,
|
||||
return os.path.join(FLAGS.log_dir,
|
||||
os.path.basename(inspect.stack()[-1][1])) + '.log'
|
||||
return None
|
||||
|
||||
@@ -71,8 +72,8 @@ def init_log():
|
||||
|
||||
log_file = _get_log_file()
|
||||
if log_file is not None:
|
||||
logging.addHandler(logging.handlers.WatchedFileHandler(log_file))
|
||||
mode = int(FLAGS.log_file_mnode, 8)
|
||||
log.addHandler(logging.handlers.WatchedFileHandler(log_file))
|
||||
mode = int(FLAGS.log_file_mode, 8)
|
||||
os.chmod(log_file, mode)
|
||||
|
||||
if FLAGS.verbose:
|
||||
|
||||
Reference in New Issue
Block a user