commit d24659ffc2db4945e1402a442c5b4ae6c0fa6107 Author: Ondrej Lichtner olichtne@redhat.com Date: Thu Oct 18 16:16:28 2012 +0200
Logs: small path change
The path where logs are located is now exactly the same as what you specify in the configuration file. Previously 'Logs' was added to the end of this path. You now need to do this manually. This change allows for the removal of the log_root argument of the class Logs. Instead log_folder should be used now.
The default path where you can find logs is <lnst_dir>/Logs .
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
Common/Config.py | 2 +- Common/Logs.py | 10 ++++------ NetTest/NetTestController.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) --- diff --git a/Common/Config.py b/Common/Config.py index e76fbef..297ebea 100644 --- a/Common/Config.py +++ b/Common/Config.py @@ -29,7 +29,7 @@ class Config():
self.options['log'] = dict() self.options['log']['path'] = os.path.join( - os.path.dirname(sys.argv[0]), './') + os.path.dirname(sys.argv[0]), './Logs')
self.options['environment'] = dict() self.options['environment']['mac_pool_range'] = \ diff --git a/Common/Logs.py b/Common/Logs.py index 41c1abf..745ed5b 100644 --- a/Common/Logs.py +++ b/Common/Logs.py @@ -150,7 +150,6 @@ class LoggingFile(object): class Logs: file_handlers = [] formatter = None - log_root = None logFolder = None logger = None root_path = None @@ -159,7 +158,7 @@ class Logs: nameExtend = None @classmethod def __init__(cls,debug=0, waitForNet=False, logger=logging.getLogger(), - recipe_path=None, log_root="Logs", to_display=True, date=None, + recipe_path=None, to_display=True, date=None, nameExtend=None, log_folder=None): logging.addLevelName(5, "DEBUG2") logging.DEBUG2 = 5 @@ -172,11 +171,10 @@ class Logs: '%(asctime)s| %(address)17.17s%(module)15.15s' ':%(lineno)4.4d| %(levelname)s: ' '%(message)s', '%d/%m %H:%M:%S', " "*4) - cls.log_root = log_root if log_folder != None: cls.logFolder = log_folder else: - cls.logFolder = os.path.dirname(sys.argv[0]) + cls.logFolder = os.path.join(os.path.dirname(sys.argv[0]), './Logs') cls.logger = logger cls.debug = debug if date is None: @@ -221,8 +219,8 @@ class Logs: recipe_path = "" root_logger = cls.logger recipe_name = os.path.splitext(os.path.split(recipe_path)[1])[0] - cls.root_path = os.path.join(cls.logFolder, cls.log_root, - cls.date+cls.nameExtend, recipe_name) + cls.root_path = os.path.join(cls.logFolder, cls.date+cls.nameExtend, + recipe_name) if (clean): cls.clean_root_log_folder(cls.root_path) for fhandler in cls.file_handlers: diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py index bb12db6..3d01310 100644 --- a/NetTest/NetTestController.py +++ b/NetTest/NetTestController.py @@ -299,7 +299,7 @@ class NetTestController: raise
logger = logging.getLogger(address) - Logs(Logs.debug, False, logger, log_root=slave_root_path, + Logs(Logs.debug, False, logger, log_folder=slave_root_path, to_display=False, date="")
info['logger'] = logger
lnst-developers@lists.fedorahosted.org