summaryrefslogtreecommitdiffstats
path: root/sdnvpn
diff options
context:
space:
mode:
authorPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-05-07 16:50:11 +0200
committerPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-05-07 16:51:05 +0200
commit9df57f96b44d41c98a556a790dfa7f96b8dc9808 (patch)
tree636be99d482e0c29a24274734e4550fc92736101 /sdnvpn
parentc1e5aafd5b5984b995d3ac6c74703e6a8be6e38b (diff)
create log file only if it doesn't exist
Change-Id: I97e4f0cf8f27ff719253967ac14e74bcd55b0559 Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
Diffstat (limited to 'sdnvpn')
-rw-r--r--sdnvpn/lib/logutil.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sdnvpn/lib/logutil.py b/sdnvpn/lib/logutil.py
index 78f6e96..3765734 100644
--- a/sdnvpn/lib/logutil.py
+++ b/sdnvpn/lib/logutil.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import logging
+import os.path
from xtesting.core import feature
@@ -15,6 +16,7 @@ from xtesting.core import feature
def getLogger(module_name):
logger = logging.getLogger(module_name)
log_file = "{}/{}.log".format("/var/lib/xtesting/results", "bgpvpn")
- open(log_file, 'w+')
+ if not os.path.exists(log_file):
+ open(log_file, 'w+')
feature.Feature.configure_logger(logger, log_file)
return logger