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
committerCarlos Goncalves <mail@cgoncalves.pt>2017-10-09 10:49:59 +0000
commit2c9569e66c4f0e333d603f93b280768bea4f2d07 (patch)
tree6459b8f961a8245fd1aaef8ba870fddf45706b1a /doctor_tests/logger.py
parent5733b9ce1dcfb40e0ef6a956c0e6c092829fc6d6 (diff)
fix to get logfile
Change-Id: I44cc6c5108eb48191ca36cbcb44f787ea542f3ce Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn> (cherry picked from commit b3dcaa337fa91b3123fa08e8b8dd2e81184a91dd)
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