summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-04-11 16:25:06 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-04-11 16:25:06 (GMT)
commit22005fc5bad9d2c3eda9defb28e6a56ede4b2c8a (patch)
tree17d41ef1d9ad985eb0d849e88eb52fcafd1b90cd /Lib/test/test_logging.py
parent135e990a75dc7ff36ae9c9c8bb6a140490b2750c (diff)
downloadcpython-22005fc5bad9d2c3eda9defb28e6a56ede4b2c8a.zip
cpython-22005fc5bad9d2c3eda9defb28e6a56ede4b2c8a.tar.gz
cpython-22005fc5bad9d2c3eda9defb28e6a56ede4b2c8a.tar.bz2
Merged revisions 79279,79284,79293,79373,79376,79379,79876,79888 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79279 | vinay.sajip | 2010-03-22 07:33:08 -0500 (Mon, 22 Mar 2010) | 1 line Issue #8200: logging: Handle errors when multiprocessing is not fully loaded when logging occurs. ........ r79284 | vinay.sajip | 2010-03-22 08:02:28 -0500 (Mon, 22 Mar 2010) | 1 line Issue #8201: logging: Handle config errors when non-ASCII and Unicode logger names exist at the same time. ........ r79293 | vinay.sajip | 2010-03-22 10:29:01 -0500 (Mon, 22 Mar 2010) | 1 line logging: Added getChild utility method to Logger and added isEnabledFor method to LoggerAdapter. ........ r79373 | vinay.sajip | 2010-03-24 09:31:21 -0500 (Wed, 24 Mar 2010) | 1 line logging: Added LOG_FTP for SysLogHandler and updated documentation. ........ r79376 | vinay.sajip | 2010-03-24 10:10:40 -0500 (Wed, 24 Mar 2010) | 1 line logging: Documentation tweak. ........ r79379 | vinay.sajip | 2010-03-24 12:36:35 -0500 (Wed, 24 Mar 2010) | 1 line logging: Updated SysLogHandler documentation. ........ r79876 | vinay.sajip | 2010-04-06 17:32:37 -0500 (Tue, 06 Apr 2010) | 1 line Issue #8327: logging: Clarification of propagation functionality in documentation. ........ r79888 | vinay.sajip | 2010-04-07 04:40:52 -0500 (Wed, 07 Apr 2010) | 1 line Issue #8331: logging: fixed some grammatical errors in documentation. ........
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 423f9d9..cec3ffe 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -68,6 +68,12 @@ class BaseTest(unittest.TestCase):
finally:
logging._releaseLock()
+ # Set two unused loggers: one non-ASCII and one Unicode.
+ # This is to test correct operation when sorting existing
+ # loggers in the configuration code. See issue 8201.
+ logging.getLogger("\xab\xd7\xbb")
+ logging.getLogger("\u013f\u00d6\u0047")
+
self.root_logger = logging.getLogger("")
self.original_logging_level = self.root_logger.getEffectiveLevel()
@@ -1731,6 +1737,23 @@ class ManagerTest(BaseTest):
self.assertEqual(logged, ['should appear in logged'])
+class ChildLoggerTest(BaseTest):
+ def test_child_loggers(self):
+ r = logging.getLogger()
+ l1 = logging.getLogger('abc')
+ l2 = logging.getLogger('def.ghi')
+ c1 = r.getChild('xyz')
+ c2 = r.getChild('uvw.xyz')
+ self.assertTrue(c1 is logging.getLogger('xyz'))
+ self.assertTrue(c2 is logging.getLogger('uvw.xyz'))
+ c1 = l1.getChild('def')
+ c2 = c1.getChild('ghi')
+ c3 = l1.getChild('def.ghi')
+ self.assertTrue(c1 is logging.getLogger('abc.def'))
+ self.assertTrue(c2 is logging.getLogger('abc.def.ghi'))
+ self.assertTrue(c2 is c3)
+
+
# Set the locale to the platform-dependent default. I have no idea
# why the test does this, but in any case we save the current locale
# first and restore it at the end.
@@ -1739,7 +1762,8 @@ def test_main():
run_unittest(BuiltinLevelsTest, BasicFilterTest,
CustomLevelsAndFiltersTest, MemoryHandlerTest,
ConfigFileTest, SocketHandlerTest, MemoryTest,
- EncodingTest, WarningsTest, ConfigDictTest, ManagerTest)
+ EncodingTest, WarningsTest, ConfigDictTest, ManagerTest,
+ ChildLoggerTest)
if __name__ == "__main__":
test_main()