Beispiel #1
0
 def test_logging_console_format(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'console-format', 'foo')
     log_cfg = make_log_config_dict(cfg)
     assert 'console' in log_cfg['formatters']
     assert log_cfg['formatters']['console']['format'] == 'foo'
     assert log_cfg['handlers']['console']['formatter'] == 'console'
Beispiel #2
0
 def test_logging_loggers(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     log_cfg = make_log_config_dict(cfg)
     assert 'root' in log_cfg
     assert 'ktbs' in log_cfg['loggers']
     assert 'rdfrest' in log_cfg['loggers']
Beispiel #3
0
 def test_logging_console_format(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'console-format', 'foo')
     log_cfg = make_log_config_dict(cfg)
     assert 'console' in log_cfg['formatters']
     assert log_cfg['formatters']['console']['format'] == 'foo'
     assert log_cfg['handlers']['console']['formatter'] == 'console'
Beispiel #4
0
 def test_logging_loggers(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     log_cfg = make_log_config_dict(cfg)
     assert 'root' in log_cfg
     assert 'ktbs' in log_cfg['loggers']
     assert 'rdfrest' in log_cfg['loggers']
Beispiel #5
0
 def test_logging_ktbs(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'ktbs-logurl', 'http://localhost:8001/logs/log/')
     log_cfg = make_log_config_dict(cfg)
     assert 'ktbslog' in log_cfg['handlers']
     assert log_cfg['handlers']['ktbslog']['class'] == 'rdfrest.util.ktbsloghandler.kTBSHandler'
     assert log_cfg['handlers']['ktbslog']['url'] == 'http://localhost:8001/logs/log/'
Beispiel #6
0
 def test_logging_file(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'filename', '/tmp/test.log')
     log_cfg = make_log_config_dict(cfg)
     assert 'filelog' in log_cfg['handlers']
     assert log_cfg['handlers']['filelog']['class'] == 'logging.FileHandler'
     assert log_cfg['handlers']['filelog']['filename'] == '/tmp/test.log'
Beispiel #7
0
 def test_logging_file(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'filename', '/tmp/test.log')
     log_cfg = make_log_config_dict(cfg)
     assert 'filelog' in log_cfg['handlers']
     assert log_cfg['handlers']['filelog']['class'] == 'logging.FileHandler'
     assert log_cfg['handlers']['filelog']['filename'] == '/tmp/test.log'
Beispiel #8
0
 def test_logging_console_level(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'console-level', 'DEBUG')
     log_cfg = make_log_config_dict(cfg)
     assert log_cfg['handlers']['console']['level'] == logging.DEBUG
     # also check that the added loggers "inherit" that level
     assert log_cfg['root']['level'] == logging.DEBUG
     assert log_cfg['loggers']['ktbs']['level'] == logging.DEBUG
     assert log_cfg['loggers']['rdfrest']['level'] == logging.DEBUG
Beispiel #9
0
 def test_logging_ktbs(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'ktbs-logurl', 'http://localhost:8001/logs/log/')
     log_cfg = make_log_config_dict(cfg)
     assert 'ktbslog' in log_cfg['handlers']
     assert log_cfg['handlers']['ktbslog'][
         'class'] == 'rdfrest.util.ktbsloghandler.kTBSHandler'
     assert log_cfg['handlers']['ktbslog'][
         'url'] == 'http://localhost:8001/logs/log/'
Beispiel #10
0
 def test_logging_console_level(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'console-level', 'DEBUG')
     log_cfg = make_log_config_dict(cfg)
     assert log_cfg['handlers']['console']['level'] == logging.DEBUG
     # also check that the added loggers "inherit" that level
     assert log_cfg['root']['level'] == logging.DEBUG
     assert log_cfg['loggers']['ktbs']['level'] == logging.DEBUG
     assert log_cfg['loggers']['rdfrest']['level'] == logging.DEBUG
Beispiel #11
0
 def test_logging_section(self):
     assert self.service_config.has_section('logging')
     log_cfg = make_log_config_dict(self.service_config)
     assert log_cfg.get('version', 1)
     assert 'loggers' in log_cfg
     assert 'handlers' in log_cfg
     assert 'console' in log_cfg['handlers']
     assert 'filelog' not in log_cfg['handlers']
     assert 'ktbslog' not in log_cfg['handlers']
     assert 'formatters' in log_cfg
     assert 'simple' in log_cfg['formatters']
Beispiel #12
0
 def test_logging_section(self):
     assert self.service_config.has_section('logging')
     log_cfg = make_log_config_dict(self.service_config)
     assert log_cfg.get('version', 1)
     assert 'loggers' in log_cfg
     assert 'handlers' in log_cfg
     assert 'console' in log_cfg['handlers']
     assert 'filelog' not in log_cfg['handlers']
     assert 'ktbslog' not in log_cfg['handlers']
     assert 'formatters' in log_cfg
     assert 'simple' in log_cfg['formatters']
Beispiel #13
0
 def test_logging_ktbs_level(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'console-level', 'WARNING')
     cfg.set('logging', 'ktbs-logurl', 'http://localhost:8001/logs/log/')
     cfg.set('logging', 'ktbs-level', 'DEBUG')
     log_cfg = make_log_config_dict(cfg)
     assert log_cfg['handlers']['ktbslog']['level'] == logging.DEBUG
     # also check that the added loggers "inherit" that level
     assert log_cfg['root']['level'] == logging.DEBUG
     assert log_cfg['loggers']['ktbs']['level'] == logging.DEBUG
     assert log_cfg['loggers']['rdfrest']['level'] == logging.DEBUG
Beispiel #14
0
 def test_logging_ktbs_level(self):
     cfg = get_service_configuration()
     cfg.set('logging', 'loggers', 'root ktbs rdfrest')
     cfg.set('logging', 'console-level', 'WARNING')
     cfg.set('logging', 'ktbs-logurl', 'http://localhost:8001/logs/log/')
     cfg.set('logging', 'ktbs-level', 'DEBUG')
     log_cfg = make_log_config_dict(cfg)
     assert log_cfg['handlers']['ktbslog']['level'] == logging.DEBUG
     # also check that the added loggers "inherit" that level
     assert log_cfg['root']['level'] == logging.DEBUG
     assert log_cfg['loggers']['ktbs']['level'] == logging.DEBUG
     assert log_cfg['loggers']['rdfrest']['level'] == logging.DEBUG