def setUp(self): super(LogLevelTestCase, self).setUp() self.CONF = self.useFixture(config.Config()).conf levels = self.CONF.default_log_levels levels.append("nova-test=AUDIT") levels.append("nova-not-debug=WARN") self.config = self.useFixture(config.Config()).config self.config(default_log_levels=levels, verbose=True) log.setup('testing') self.log = log.getLogger('nova-test') self.log_no_debug = log.getLogger('nova-not-debug')
def setUp(self): super(LogConfigTestCase, self).setUp() self.config = self.useFixture(config.Config()).config self.log_config_append = \ fileutils.write_to_tempfile(content=self.minimal_config, prefix='logging', suffix='.conf' )
def setUp(self): super(DomainTestCase, self).setUp() self.config = self.useFixture(config.Config()).config self.config(logging_context_format_string="[%(request_id)s]: " "%(user_identity)s " "%(message)s") self.mylog = log.getLogger() self._add_handler_with_cleanup(self.mylog) self._set_log_level_with_cleanup(self.mylog, logging.DEBUG)
def setUp(self): super(CommonLoggerTestsMixIn, self).setUp() self.config = self.useFixture(config.Config()).config # common context has different fields to the defaults in log.py self.config(logging_context_format_string='%(asctime)s %(levelname)s ' '%(name)s [%(request_id)s ' '%(user)s %(tenant)s] ' '%(message)s') self.log = None log._setup_logging_from_conf('test', 'test')
def setUp(self): super(ContextFormatterTestCase, self).setUp() self.config = self.useFixture(config.Config()).config self.config(logging_context_format_string="HAS CONTEXT " "[%(request_id)s]: " "%(message)s", logging_default_format_string="NOCTXT: %(message)s", logging_debug_format_suffix="--DBG") self.log = log.getLogger('') # obtain root logger instead of 'unknown' self._add_handler_with_cleanup(self.log) self._set_log_level_with_cleanup(self.log, logging.DEBUG)
def setUp(self): super(FancyRecordTestCase, self).setUp() self.config = self.useFixture(config.Config()).config # NOTE(sdague): use the different formatters to demonstrate format # string with valid fancy keys and without. Slightly hacky, but given # the way log objects layer up seemed to be most concise approach self.config(logging_context_format_string="%(color)s " "[%(request_id)s]: " "%(instance)s" "%(message)s", logging_default_format_string="%(missing)s: %(message)s") self.colorlog = log.getLogger() self._add_handler_with_cleanup(self.colorlog, log.ColorHandler) self._set_log_level_with_cleanup(self.colorlog, logging.DEBUG)
def setUp(self): super(LogConfigOptsTestCase, self).setUp() self.CONF = self.useFixture(config.Config()).conf
def setUp(self): super(PublishErrorsHandlerTestCase, self).setUp() self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs self.config = self.useFixture(config.Config()).config self.publiserrorshandler = log_handler.\ PublishErrorsHandler(logging.ERROR)
def setUp(self): super(LogHandlerTestCase, self).setUp() self.config = self.useFixture(config.Config()).config