I\'m trying to decipher the information contained in my logs (the logging setup is using the default formatter). The documentation states:
Do formatting f
The default format is located here which is:
BASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s"
The Format code will tell you how you can customize it. Here is one example on how you can customize it.
import sys
import logging
logging.basicConfig(
level=logging.DEBUG,
format="[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s",
datefmt="%d/%b/%Y %H:%M:%S",
stream=sys.stdout)
logging.info("HEY")
Which results in:
[26/May/2013 06:41:40] INFO [root.:1] HEY