Created
November 22, 2013 14:36
-
-
Save proffalken/7600818 to your computer and use it in GitHub Desktop.
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 characters
import sys | |
import logging.config | |
import logging | |
import os.path | |
LOGGING_CONF=os.path.join(os.path.dirname(__file__), | |
"logging.ini") | |
logging.config.fileConfig(LOGGING_CONF) | |
fallthrough = logging.getLogger("root") | |
childlog = logging.getLogger("child") | |
childlog.error("Child Error") | |
fallthrough.info("Root info") |
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 characters
[loggers] | |
keys = root, child | |
[handlers] | |
keys = watchedfile | |
[formatters] | |
keys = default | |
[logger_root] | |
qualname = root | |
level = DEBUG | |
handlers = watchedfile | |
[logger_child] | |
qualname = child | |
level = WARNING | |
handlers = watchedfile | |
propagate = 0 | |
# Our default handler to write all messages direct to disk | |
[handler_watchedfile] | |
class = handlers.WatchedFileHandler | |
args = ('test.log',) | |
formatter = default | |
[formatter_default] | |
datefmt = %Y-%m-%d %H:%M:%S | |
args = (datefmt=datefmt) | |
format = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s %(message)s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment