- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/pslogger.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippToPsps/jython/pslogger.py
r32107 r33415 3 3 import os 4 4 import sys 5 import socket 5 6 6 7 class PSLogger(logging.getLoggerClass()): 7 8 8 9 ''' 9 Sets up logging using values from the ippToPsps config file 10 Sets up logging using provided values and this process hostname and PID if sending to file 11 This will default to stout and no file output 10 12 ''' 11 def setup(self, doc, name, stdout=1, sendToFile=0):13 def setup(self, programName, basePath, configName, host, pid, stdout=1, sendToFile=0): 12 14 13 15 formatter = logging.Formatter('%(asctime)s | %(levelname)7s | %(message)s', '%Y-%m-%d %H:%M:%S') … … 15 17 16 18 if sendToFile: 17 PATH = doc.find("localOutPath").text + "/log" 19 20 # generate path 21 PATH = basePath + "/log" 18 22 if not os.path.exists(PATH): os.makedirs(PATH) 19 DVOLABEL = doc.find("dvo/gpc1Label").text 20 FULLPATH = PATH + "/" + name + "_" + DVOLABEL + ".log" 21 23 FULLPATH = PATH + "/" + programName + "_" + configName + "_" + host + "_" + str(pid) + ".log" 22 24 # opens file to be appended 23 25 hdlr = logging.FileHandler(FULLPATH, "a") … … 27 29 if stdout: 28 30 stdout = logging.StreamHandler(sys.__stdout__) 29 #stdout.setFormatter(formatter)31 stdout.setFormatter(formatter) 30 32 self.addHandler(stdout) 31 33
Note:
See TracChangeset
for help on using the changeset viewer.
