summaryrefslogtreecommitdiffstats
path: root/doctor_tests/logger.py
diff options
context:
space:
mode:
authordongwenjuan <dong.wenjuan@zte.com.cn>2017-10-09 15:25:33 +0800
committerdongwenjuan <dong.wenjuan@zte.com.cn>2017-10-09 15:51:31 +0800
commitb3dcaa337fa91b3123fa08e8b8dd2e81184a91dd (patch)
tree6459b8f961a8245fd1aaef8ba870fddf45706b1a /doctor_tests/logger.py
parent4f6132978ad548ee1e696016d450d0b4a4cbab9f (diff)
fix to get logfile
Change-Id: I44cc6c5108eb48191ca36cbcb44f787ea542f3ce Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'doctor_tests/logger.py')
-rw-r--r--doctor_tests/logger.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/doctor_tests/logger.py b/doctor_tests/logger.py
index 2da2c0de..e6689467 100644
--- a/doctor_tests/logger.py
+++ b/doctor_tests/logger.py
@@ -15,6 +15,8 @@
import logging
import os
+from doctor_tests.common.utils import get_doctor_test_root_dir
+
class Logger(object):
def __init__(self, logger_name):
@@ -36,12 +38,15 @@ class Logger(object):
ch.setLevel(logging.INFO)
self.logger.addHandler(ch)
- filename = '%s.log' % logger_name
- file_handler = logging.FileHandler(filename, mode='w')
+ test_dir = get_doctor_test_root_dir()
+ self.filename = '{0}/{1}.log'.format(test_dir, logger_name)
+ file_handler = logging.FileHandler(self.filename, mode='w')
file_handler.setFormatter(formatter)
file_handler.setLevel(logging.DEBUG)
- self.filename = file_handler.baseFilename
self.logger.addHandler(file_handler)
def getLogger(self):
return self.logger
+
+ def getLogFilename(self):
+ return self.filename