Show
Ignore:
Timestamp:
11/28/08 15:08:22 (3 years ago)
Author:
chris@…
Branch:
unix
Message:

No longer use an external config file for logging

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • StormSiren/Config.py

    r122 r184  
    4848 
    4949class Config(object): 
    50         def __init__(self, appname, config_file = None, log_config_file = None): 
    51                 self.log                  = None 
     50        def __init__(self, appname, config_file = None): 
    5251                self.__appname            = appname 
    5352                self.__config_file        = '' 
     
    5554                self.__config_dir         = self.___getConfigDir() 
    5655                self.__config_file        = self.__config_dir + '/' + appname + '.conf' 
    57                 self.__log_config_file    = self.__config_dir + '/' + appname + '-log.conf' 
     56                self.log                  = logging.getLogger('Config') 
    5857 
    59                 if(log_config_file): 
    60                         self.__log_config_file = log_config_file 
    61  
    62                 if(os.path.exists(self.__log_config_file)): 
    63                         logging.config.fileConfig(self.__log_config_file) 
    64                 else: 
    65                         print("Log configuration file [%s] not found" % self.__log_config_file) 
    66                         print("See the example StormSiren-log.conf file in the examples directory") 
    67                         if(not os.path.exists(self.__config_dir)): 
    68                                 os.mkdir(self.__config_dir) 
    69                         sys.exit(1) 
    70  
    71                 self.log                  = logging.getLogger('Config') 
    72                 self.log.debug("Using logging configuration file %s" % self.__log_config_file) 
     58                self.log.setLevel(logging.INFO) 
    7359 
    7460                if(config_file): 
    7561                        self.__config_file = config_file 
    76                         self.log.info("Override configuration file %s" % self.__config_file) 
    7762 
    7863                if(os.path.exists(self.__config_file)): 
    7964                        self.log.debug("Using configuration file with %s" % self.__config_file) 
    80                         self.__configParser.read(self.__config_file) 
    81                         self._load() 
    8265                else: 
    8366                        self.log.error("Configuration file [%s] not found" % self.__config_file) 
     
    121104        def _load(self): 
    122105                self.log.debug("Loading Configuration File") 
     106                self.__configParser.read(self.__config_file) 
    123107 
    124108        def __str__(self):