Пример #1
0
 def setUp(self):
     # clear file
     try: os.remove(LOGFILE)
     except: pass
     # configure logging system
     path = os.path.dirname(__file__) + '/' + CONFIGFILE
     config.replace_configuration(path)
     self.log = logging.getLogger('stack')
Пример #2
0
 def setUp(self):
     # clear file
     try: os.remove(LOGFILE)
     except: pass
     # configure logging system
     path = os.path.dirname(__file__) + '/' + CONFIGFILE
     config.replace_configuration(path)
     self.log = logging.getLogger('block')
Пример #3
0
    def xtest_logging_root(self):
        """ initial root log level is WARN -- test that we can change it to ERROR """
        config.replace_configuration(os.path.join(TEST_DIR, 'logging.yml'))
        otherlog = logging.getLogger('pyon.container')

        self.assertTrue(otherlog.isEnabledFor(logging.WARN))
        #
        handler = pyon.container.management.LogLevelHandler()
        action = IonObject(OT.ChangeLogLevel, logger='pyon', level='ERROR')
        handler.handle_request(action)
        #
        self.assertFalse(otherlog.isEnabledFor(logging.WARN))
Пример #4
0
    def test_logging_handler(self):
        """ initial log level for ion.process.event is INFO -- test we can change it to TRACE """
        config.replace_configuration(os.path.join(TEST_DIR, 'logging.yml'))
        log.debug('this should probably not be logged')

        self.assertFalse(log.isEnabledFor(TRACE))
        #
        handler = pyon.container.management.LogLevelHandler()
        action = IonObject(OT.ChangeLogLevel, logger='pyon.container', level='TRACE')
        handler.handle_request(action)
        #
        self.assertTrue(log.isEnabledFor(TRACE))
Пример #5
0
    def test_logging_clear(self):
        """ initial log level for ion.process.event is INFO -- test that we can clear it
            (root level WARN should apply)
        """
        config.replace_configuration(os.path.join(TEST_DIR, 'logging.yml'))
        log.debug('this should probably not be logged')

        self.assertTrue(log.isEnabledFor(logging.INFO), msg=repr(log.__dict__))
        #
        handler = pyon.container.management.LogLevelHandler()
        action = IonObject(OT.ChangeLogLevel, logger='pyon.container', level='WARN')
        handler.handle_request(action)

        self.assertFalse(log.isEnabledFor(logging.INFO))
Пример #6
0
    def setUp(self):
        # clear file
        try: os.remove(RAW_LOGFILE)
        except: pass
        try: os.remove(REPLAY_LOGFILE)
        except: pass
        # configure logging system
        path = os.path.dirname(__file__) + '/' + CONFIGFILE
        config.replace_configuration(path)
        self.log = logging.getLogger('raw')

        replay_log = logging.getLogger('replay')
        handler = replay_log.handlers[0]
        self.replay = putil.logging.replay.Replayer(handler)
Пример #7
0
    def setUp(self):
        # clear file
        try:
            os.remove(RAW_LOGFILE)
        except:
            pass
        try:
            os.remove(REPLAY_LOGFILE)
        except:
            pass
        # configure logging system
        path = os.path.dirname(__file__) + '/' + CONFIGFILE
        config.replace_configuration(path)
        self.log = logging.getLogger('raw')

        replay_log = logging.getLogger('replay')
        handler = replay_log.handlers[0]
        self.replay = putil.logging.replay.Replayer(handler)