Example #1
0
def test_setup_alternate_logging():
    namespaces['root'].config['debug'] = True
    setup_logging(clear_loggers=True, level='DEBUG', to_console=True)  
    
    namespaces['root'].config['debug'] = False
    setup_logging(clear_loggers=True, level='INFO', to_console=True)  
    
    namespaces['root'].config['log_max_bytes'] = 1024000
    namespaces['root'].config['log_level'] = 'warn'
    setup_logging()  
Example #2
0
def test_setup_alternate_logging():
    namespaces['root'].config['debug'] = True
    setup_logging(clear_loggers=True, level='DEBUG', to_console=True)

    namespaces['root'].config['debug'] = False
    setup_logging(clear_loggers=True, level='INFO', to_console=True)

    namespaces['root'].config['log_max_bytes'] = 1024000
    namespaces['root'].config['log_level'] = 'warn'
    setup_logging()
Example #3
0
def test_setup_logging_per_bogus_config_file():
    namespaces['root'].config['logging_config_file'] = 'bollox'
    setup_logging()
    
Example #4
0
def test_setup_logging_per_config_file():
    namespaces['root'].config['logging_config_file'] = '../config/cement-test-logging.conf'
    setup_logging()
Example #5
0
def test_setup_logging_per_bogus_config_file():
    namespaces['root'].config['logging_config_file'] = 'bollox'
    setup_logging()
Example #6
0
def test_setup_logging_per_config_file():
    namespaces['root'].config[
        'logging_config_file'] = '../config/cement-test-logging.conf'
    setup_logging()
Example #7
0
     sys.stdout = buf_stdout
     sys.stderr = buf_stderr
 if '--json' in sys.argv:
     sys.stdout = buf_stdout
     sys.stderr = buf_stderr
     namespaces['root'].config['output_handler_override'] = 'json'
     namespaces['root'].config['show_plugin_load'] = False
 # debug trumps everything
 if '--debug' in sys.argv:
     namespaces['root'].config['debug'] = True
     namespaces['root'].config['log_to_console'] = True
     sys.stdout = SAVED_STDOUT
     sys.stderr = SAVED_STDERR
     
 # Setup logging for console and file
 setup_logging(to_console=namespaces['root'].config['log_to_console'],
               clear_loggers=clear_loggers)
 log = get_logger(__name__)
 log.debug('logging initialized')
 log.debug('setup app per the following configs: %s' % \
           namespaces['root'].config['config_files'])
 define_default_hooks()
 define_default_handler_types()
 
 register_default_handlers()
 
 __import__("%s.bootstrap" % namespaces['root'].config['app_module'], 
            globals(), locals(), ['root'])
 
 for res in run_hooks('post_bootstrap_hook'):
     pass