|
1 |
| -# Copyright 2001-2021 by Vinay Sajip. All Rights Reserved. |
| 1 | +# Copyright 2001-2022 by Vinay Sajip. All Rights Reserved. |
2 | 2 | #
|
3 | 3 | # Permission to use, copy, modify, and distribute this software and its
|
4 | 4 | # documentation for any purpose and without fee is hereby granted,
|
|
16 | 16 |
|
17 | 17 | """Test harness for the logging module. Run all tests.
|
18 | 18 |
|
19 |
| -Copyright (C) 2001-2021 Vinay Sajip. All Rights Reserved. |
| 19 | +Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved. |
20 | 20 | """
|
21 | 21 |
|
22 | 22 | import logging
|
@@ -3439,6 +3439,36 @@ def emit(self, record):
|
3439 | 3439 | logging.info('some log')
|
3440 | 3440 | self.assertEqual(stderr.getvalue(), 'some log my_type\n')
|
3441 | 3441 |
|
| 3442 | + def test_90195(self): |
| 3443 | + # See gh-90195 |
| 3444 | + config = { |
| 3445 | + 'version': 1, |
| 3446 | + 'disable_existing_loggers': False, |
| 3447 | + 'handlers': { |
| 3448 | + 'console': { |
| 3449 | + 'level': 'DEBUG', |
| 3450 | + 'class': 'logging.StreamHandler', |
| 3451 | + }, |
| 3452 | + }, |
| 3453 | + 'loggers': { |
| 3454 | + 'a': { |
| 3455 | + 'level': 'DEBUG', |
| 3456 | + 'handlers': ['console'] |
| 3457 | + } |
| 3458 | + } |
| 3459 | + } |
| 3460 | + logger = logging.getLogger('a') |
| 3461 | + self.assertFalse(logger.disabled) |
| 3462 | + self.apply_config(config) |
| 3463 | + self.assertFalse(logger.disabled) |
| 3464 | + # Should disable all loggers ... |
| 3465 | + self.apply_config({'version': 1}) |
| 3466 | + self.assertTrue(logger.disabled) |
| 3467 | + del config['disable_existing_loggers'] |
| 3468 | + self.apply_config(config) |
| 3469 | + # Logger should be enabled, since explicitly mentioned |
| 3470 | + self.assertFalse(logger.disabled) |
| 3471 | + |
3442 | 3472 | class ManagerTest(BaseTest):
|
3443 | 3473 | def test_manager_loggerclass(self):
|
3444 | 3474 | logged = []
|
|
0 commit comments