From ca80941c5bdee878f0ca715a4df9fc00a88cd85b Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Fri, 24 Jan 2014 09:04:11 -0600 Subject: [PATCH] Issue #2504 Add hostname to log path for GFESuite scripts Change-Id: I734d8f6ec89720d23371bd9c1187ef95eeaf22eb Former-commit-id: 25cf05060d0c8ea339abfb53b38519490c27315b [formerly 975cf49b49e6266081e7b9ebcce6782b3e411667] Former-commit-id: e13a34a8b38e8879c1510a8ce7bb2b73a8f054e8 --- .../utility/edex_static/base/gfe/isc/iscUtil.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py index 3ad6837ecf..4a72410c98 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py @@ -19,7 +19,7 @@ ## import string, IrtAccess, JUtil, logging -import xml, pickle, tempfile, os +import xml, pickle, tempfile, os, socket from xml.etree import ElementTree from xml.etree.ElementTree import Element, SubElement import LogStream @@ -50,7 +50,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization # 03/11/13 1759 dgilling Move siteConfig import into # methods where it's needed. # 11/07/13 2517 randerso Allow getLogger to override logLevel -# +# 01/22/14/ 2504 randerso Added hostname to log path # # @@ -285,17 +285,17 @@ def getLogger(scriptName, logName=None, logLevel=logging.INFO): # modify its include path with the proper siteConfig just before # execution time import siteConfig - + hostname = socket.gethostname().split('.')[0] + logPath = os.path.join(siteConfig.GFESUITE_LOGDIR, strftime("%Y%m%d", gmtime()), hostname) if logName is None: - logPath = siteConfig.GFESUITE_LOGDIR + "/" + strftime("%Y%m%d", gmtime()) logName = scriptName + ".log" else: - logPath = os.path.dirname(logName) - if len(logPath) == 0: - logPath = siteConfig.GFESUITE_LOGDIR + "/" + strftime("%Y%m%d", gmtime()) + logDir = os.path.dirname(logName) + if len(logDir) > 0: + logPath = logDir logName = os.path.basename(logName) - logFile = logPath + "/" + logName + logFile = os.path.join(logPath, logName) if not os.path.exists(logPath): os.makedirs(logPath)