Lines Matching full:handlers
23 import logging.handlers
119 hlist = self.logger1.handlers + self.root_logger.handlers
120 raise AssertionError('Unexpected handlers: %s' % hlist)
122 hlist = self.logger2.handlers + self.root_logger.handlers
123 raise AssertionError('Unexpected handlers: %s' % hlist)
133 while self.root_logger.handlers:
134 h = self.root_logger.handlers[0]
346 handler = self.root_logger.handlers[0]
375 handler = self.root_logger.handlers[0]
485 self.root_logger.handlers[0].setLevel(SOCIABLE)
497 self.root_logger.handlers[0].setLevel(logging.NOTSET)
502 handler = self.root_logger.handlers[0]
552 # We can't actually *use* too many handlers in the tests,
560 h = logging.handlers.WatchedFileHandler(fn, encoding='utf-8', delay=True)
584 h = logging.handlers.SysLogHandler(sockname)
592 self.assertRaises(ValueError, logging.handlers.HTTPHandler,
595 h = logging.handlers.HTTPHandler('localhost', '/log', method)
597 h = logging.handlers.BufferingHandler(0)
601 h = logging.handlers.BufferingHandler(1)
607 Test that Path objects are accepted as filename arguments to handlers.
617 (logging.handlers.RotatingFileHandler, (pfn, 'a')),
618 (logging.handlers.TimedRotatingFileHandler, (pfn, 'h')),
621 cases += ((logging.handlers.WatchedFileHandler, (pfn, 'w')),)
652 h = logging.handlers.WatchedFileHandler(fn, encoding='utf-8', delay=delay)
1071 h = logging.handlers.SMTPHandler(addr, 'me', 'you', 'Log',
1102 self.mem_hdlr = logging.handlers.MemoryHandler(10, logging.WARNING,
1157 self.mem_hdlr = logging.handlers.MemoryHandler(10, logging.WARNING,
1215 [handlers]
1223 handlers=hand1
1241 [handlers]
1249 handlers=
1253 handlers=hand1
1273 [handlers]
1281 handlers=hand1
1285 handlers=
1311 [handlers]
1319 handlers=hand1
1336 # config6 uses ', ' delimiters in the handlers and formatters sections
1341 [handlers]
1349 handlers=
1353 handlers=hand1
1383 [handlers]
1391 handlers=hand1
1395 handlers=
1401 handlers=
1421 [handlers]
1429 handlers=file
1442 [handlers]
1450 handlers=screen
1603 handler = logging.root.handlers[0]
1620 [handlers]
1627 handlers=hand1
1637 self.assertEqual(logging.getLogger().handlers[0].name, 'hand1')
1647 [handlers]
1659 handlers=console
1707 hcls = logging.handlers.SocketHandler
1713 self.root_logger.removeHandler(self.root_logger.handlers[0])
1821 hcls = logging.handlers.DatagramHandler
1827 self.root_logger.removeHandler(self.root_logger.handlers[0])
1902 hcls = logging.handlers.SysLogHandler
1908 self.root_logger.removeHandler(self.root_logger.handlers[0])
2006 root_logger.removeHandler(self.root_logger.handlers[0])
2030 self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob',
2191 self.assertEqual(logger.handlers, [])
2194 self.assertEqual(len(logger.handlers), 1)
2195 self.assertIsInstance(logger.handlers[0], logging.NullHandler)
2226 'handlers' : {
2236 'handlers' : ['hand1'],
2248 'handlers' : {
2259 'handlers' : ['hand1'],
2275 'handlers' : {
2290 'handlers' : ['hand1'],
2302 'handlers' : {
2313 'handlers' : ['hand1'],
2329 'handlers' : {
2340 'handlers' : ['hand1'],
2357 'handlers' : {
2368 'handlers' : ['hand1'],
2384 'handlers' : {
2395 'handlers' : ['hand1'],
2412 'handlers' : {
2422 'handlers' : ['hand1'],
2443 'handlers' : {
2456 'handlers' : ['hand1'],
2468 'handlers' : {
2479 'handlers' : ['hand1'],
2496 'handlers' : {
2508 'handlers' : ['hand1'],
2525 'handlers' : {
2536 'handlers' : ['hand1'],
2555 'handlers' : {
2566 'handlers' : ['hand1'],
2585 'handlers' : {
2596 'handlers' : ['hand1'],
2613 'handlers' : {
2624 'handlers' : ['hand1'],
2635 'handlers' : {
2650 'handlers' : {
2675 'handlers' : {
2692 'handlers' : ['hand1'],
2713 'handlers' : {
2719 'handlers' : ['hand1'],
2743 'handlers' : {
2749 'handlers' : ['hand1'],
2774 'handlers' : {
2780 'handlers' : ['hand1'],
2796 'handlers' : {
2810 'handlers' : ['hand1'],
2822 "handlers": {
2829 "class": "logging.handlers.MemoryHandler",
2839 "handlers": ["bufferGlobal"],
2855 'handlers' : {
2866 "handlers": ["hand1"],
2882 'handlers' : {
2893 "handlers": ["hand1"],
2909 'handlers' : {
2920 "handlers": ["hand1"],
2936 'handlers' : {
2947 "handlers": ["hand1"],
3210 "handlers": {
3218 "handlers": ["file"]
3225 handler = logging.root.handlers[0]
3359 handler = logging.getLogger('mymodule').handlers[0]
3366 handler = logging.getLogger("my_test_logger_custom_formatter").handlers[0]
3371 handler = logging.getLogger("my_test_logger_custom_formatter").handlers[0]
3380 handler = logging.getLogger("my_test_logger_custom_formatter").handlers[0]
3429 'handlers': {
3435 'root': {'level': 'INFO', 'handlers': ['myhandler']},
3527 self.que_hdlr = logging.handlers.QueueHandler(self.queue)
3563 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
3564 'logging.handlers.QueueListener required for this test')
3567 listener = logging.handlers.QueueListener(self.queue, handler)
3584 listener = logging.handlers.QueueListener(self.queue, handler,
3598 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
3599 'logging.handlers.QueueListener required for this test')
3602 listener = logging.handlers.QueueListener(self.queue, self.root_hdlr)
3612 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
3613 'logging.handlers.QueueListener required for this test')
3619 listener = logging.handlers.QueueListener(self.queue, self.que_hdlr)
3625 if hasattr(logging.handlers, 'QueueListener'):
3646 handler = logging.handlers.QueueHandler(log_queue)
3648 listener = logging.handlers.QueueListener(log_queue)
3661 @patch.object(logging.handlers.QueueListener, 'handle')
3669 @patch.object(logging.handlers.QueueListener, 'handle')
3708 expected = [[], [logging.handlers.QueueListener._sentinel]]
3717 listener = logging.handlers.QueueListener(log_queue)
4085 # No handlers and no last resort, so 'No handlers' message
4089 msg = 'No handlers could be found for logger "root"\n'
4092 # 'No handlers' message only printed once
4149 # create some fake handlers
4154 # create live weakref to those handlers
4155 handlers = map(logging.weakref.ref, [handler0, handler1, handler2])
4157 logging.shutdown(handlerList=list(handlers))
4167 handlers = [logging.weakref.ref(handler)]
4169 logging.shutdown(handlerList=list(handlers))
4508 self.handlers = logging.root.handlers
4513 logging.root.handlers = []
4516 for h in logging.root.handlers[:]:
4522 setattr(logging.root, 'handlers', self.handlers)
4532 self.assertEqual(len(logging.root.handlers), 1)
4533 handler = logging.root.handlers[0]
4573 self.assertEqual(len(logging.root.handlers), 1)
4574 handler = logging.root.handlers[0]
4591 handler = logging.root.handlers[0]
4601 self.assertEqual(len(logging.root.handlers), 1)
4602 handler = logging.root.handlers[0]
4609 formatter = logging.root.handlers[0].formatter
4615 formatter = logging.root.handlers[0].formatter
4621 formatter = logging.root.handlers[0].formatter
4636 handlers = [logging.StreamHandler()]
4641 handlers=handlers)
4643 handlers=handlers)
4650 handlers = [
4656 handlers[2].setFormatter(f)
4657 logging.basicConfig(handlers=handlers)
4658 self.assertIs(handlers[0], logging.root.handlers[0])
4659 self.assertIs(handlers[1], logging.root.handlers[1])
4660 self.assertIs(handlers[2], logging.root.handlers[2])
4661 self.assertIsNotNone(handlers[0].formatter)
4662 self.assertIsNotNone(handlers[1].formatter)
4663 self.assertIs(handlers[2].formatter, f)
4664 self.assertIs(handlers[0].formatter, handlers[1].formatter)
4671 logging.basicConfig(level=logging.WARNING, handlers=old_handlers)
4675 self.assertEqual(len(logging.root.handlers), 1)
4676 logging.basicConfig(level=logging.INFO, handlers=new_handlers,
4681 self.assertEqual(len(logging.root.handlers), 1)
4694 self.assertEqual(len(logging.root.handlers), 1)
4695 handler = logging.root.handlers[0]
4714 self.assertEqual(len(logging.root.handlers), 1)
4715 handler = logging.root.handlers[0]
4732 self.assertEqual(len(logging.root.handlers), 1)
4733 handler = logging.root.handlers[0]
4754 self.assertEqual(len(logging.root.handlers), 1)
4755 handler = logging.root.handlers[0]
4781 # logging.root has no handlers so basicConfig should be called
4890 for handler in self.logger.handlers:
5040 for handler in self.logger.handlers:
5200 rh = logging.handlers.RotatingFileHandler(
5207 rh = logging.handlers.RotatingFileHandler(
5213 rh = logging.handlers.RotatingFileHandler(self.fn, encoding="utf-8", maxBytes=1)
5220 rh = logging.handlers.RotatingFileHandler(self.fn, encoding="utf-8")
5228 rh = logging.handlers.RotatingFileHandler(
5241 class HandlerWithNamerAndRotator(logging.handlers.RotatingFileHandler):
5272 rh = logging.handlers.RotatingFileHandler(
5307 fh = logging.handlers.TimedRotatingFileHandler(
5316 fh = logging.handlers.TimedRotatingFileHandler(
5359 assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
5361 assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
5363 assertRaises(ValueError, logging.handlers.TimedRotatingFileHandler,
5369 rh = logging.handlers.TimedRotatingFileHandler(
5390 rh = logging.handlers.TimedRotatingFileHandler(
5436 rotator = logging.handlers.TimedRotatingFileHandler(p, when='s',
5483 rh = logging.handlers.TimedRotatingFileHandler(
5501 r = logging.handlers._MIDNIGHT - ((currentHour * 60 +
5526 h = logging.handlers.NTEventLogHandler('test_logging')