Created
March 24, 2015 01:07
-
-
Save carljm/6bd0b1b87590b1429ce7 to your computer and use it in GitHub Desktop.
Revisions
-
carljm created this gist
Mar 24, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ from logging.config import dictConfig import logging initial = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'console': { 'class': 'logging.StreamHandler', }, }, 'loggers': { 'foo.bar': { 'handlers': ['console'], }, }, } dictConfig(initial) foobar1 = logging.getLogger('foo.bar') foobar1.warn('warn from foo.bar (1)') foobarbaz1 = logging.getLogger('foo.bar.baz') foobarbaz1.warn('warn from foo.bar.baz (1)') new = { 'version': 1, 'disable_existing_loggers': True, 'handlers': { 'console': { 'class': 'logging.StreamHandler', }, }, 'loggers': { 'foo': { }, }, 'root': { 'handlers': ['console'], }, } dictConfig(new) foobar2 = logging.getLogger('foo.bar') foobar2.warn('warn from foo.bar (2)') foobarbaz2 = logging.getLogger('foo.bar.baz') foobarbaz2.warn('warn from foo.bar.baz (2)')