예제 #1
0
def get_cass_log_file(config):
    LOGGER.debug("[get_cass_log_file] called")
    log_yaml = os.path.join(config.cass_home, 'conf',
                            'log4j-server.properties')
    log_file = None
    try:
        yaml_data = load_yaml(log_yaml)
        log_file = yaml_data['log4j.appender.R.file']
    except yaml.error.YAMLError:
        fh = open(log_yaml, 'r')
        for line in fh.readlines():
            if re.match('^log4j.appender.R.File=(.*)$', line):
                log_file = line.split('=')
                if len(log_file):
                    log_file = log_file[1]
                break
        fh.close()
    except TypeError as exc:
        LOGGER.exception("[get_cass_log_file] opening cassandra log yaml [%s]",
                         exc)

    LOGGER.debug("[get_cass_log_file] leaving [%s]", log_file)
    if log_file:
        return log_file.replace('\n', '')
    else:
        raise PolitesException("error finding cassandra log file")
예제 #2
0
 def test_yaml(self):
     self.assertEqual(None, utils.load_yaml(self.settings_location +
                      '/restore-cassandra.yaml.DNE'))