def convert_log_output(namespace): """ Scrapes log4j output, forwarding the log output to the corresponding Python logging endpoint. """ while True: line = self.process.stderr.readline().strip() if not line: continue try: name, level, message = \ methodmap('strip', line.split(':', 2)) logger = logging.getLogger('%s.%s' % (namespace, name)) logger.log(getattr(logging, level.upper()), message) except Exception: logger = logging.getLogger('%s.raw' % namespace) logger.warning(line)
def test_methodmap(self): self.assertEqual(methodmap(self.method, self.values), self.expected)