summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordongwenjuan <dong.wenjuan@zte.com.cn>2017-08-23 16:33:17 +0800
committerdongwenjuan <dong.wenjuan@zte.com.cn>2017-08-23 16:33:17 +0800
commit96665938926b5083cf917517e2ecb7c7267d72c1 (patch)
treefe14d7751da62735782efd6b67133bb38e3b6b93 /tests
parentc9fb5207df1a3aa579d86f413587ec47c41063af (diff)
Specify the filename for 'w' filemode
FileHandler use 'a' mode in default for writing the file. Change-Id: Ie19d80e5ff286da2722634787dcffe36234c0119 Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'tests')
-rw-r--r--tests/logger.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/logger.py b/tests/logger.py
index 021389d9..80d19bb9 100644
--- a/tests/logger.py
+++ b/tests/logger.py
@@ -21,7 +21,8 @@ class Logger(object):
CI_DEBUG = os.getenv('CI_DEBUG')
- logging.basicConfig(filemode='w')
+ filename = '%s.log' % logger_name
+ logging.basicConfig(filemode='w', filename=filename)
self.logger = logging.getLogger(logger_name)
self.logger.propagate = 0
self.logger.setLevel(logging.DEBUG)
@@ -37,7 +38,7 @@ class Logger(object):
ch.setLevel(logging.INFO)
self.logger.addHandler(ch)
- file_handler = logging.FileHandler('%s.log' % logger_name)
+ file_handler = logging.FileHandler(filename)
file_handler.setFormatter(formatter)
file_handler.setLevel(logging.DEBUG)
self.logger.addHandler(file_handler)