Changeset 683 in tmcsimulator for trunk/src


Ignore:
Timestamp:
09/28/2022 10:58:59 AM (4 years ago)
Author:
jdalbey
Message:

Revised unified logger to accept an optional command line parameter specifying the directory that contains logging_service.cfg. Default is 'config' for production.

Location:
trunk/src/python/unifiedlogger
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/python/unifiedlogger/__main__.py

    r645 r683  
    1 import logging_service, os, ConfigParser 
     1import logging_service, os, sys, ConfigParser 
    22# This main module is provided so the application can be conveniently bundled for deployment 
    33def main(): 
     
    1010        revNum = "?" 
    1111    print "Unified Logging Service v"+revNum,"starting from ",os.getcwd() 
    12     logging_service.startup() 
     12    logging_service.startup(sys.argv) 
    1313 
    1414if __name__ == '__main__': 
  • trunk/src/python/unifiedlogger/logging_service.py

    r649 r683  
    1 import cms_watcher, har_watcher, cad_watcher, activitylog_watcher, time, json, ConfigParser 
     1import sys, cms_watcher, har_watcher, cad_watcher, activitylog_watcher, time, json, ConfigParser 
    22# Unified Logging Service 
    33# jdalbey 7/6/2019 
     
    2424    return toHMS(seconds) 
    2525 
    26 def startup(): 
     26# Entry point 
     27# @param list of command line arguments 
     28#        can provide name of config directory to use 
     29def startup(args): 
     30    configdir = "config"  # default dir for production 
     31    # See if a config dir was given on command line 
     32    if len(args) == 2: 
     33        configdir = args[1] 
     34 
    2735    # get path to output file from configuration 
    2836    config = ConfigParser.ConfigParser() 
    29     config.read('config/logging_service.cfg') 
     37    config.read(configdir + '/logging_service.cfg') 
    3038    logfilepath  = config.get('Paths', 'UnifiedLogPath') 
    3139     
     
    7987#END DO 
    8088 
     89# for unit testing 
    8190if __name__ == '__main__': 
    82     startup() 
     91    startup(sys.argv) 
Note: See TracChangeset for help on using the changeset viewer.