logging.log code example
Example 1: logging.logger
import logging
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug("some debugging...")
logger.error("some error...")
Example 2: logging.debug vs logger
Logger logger = Logger.getLogger("com.foo");
logger.setLevel(Level.INFO);
Logger barlogger = Logger.getLogger("com.foo.Bar");
logger.warn("Low fuel level.");
logger.debug("Starting search for nearest gas station.");
barlogger.info("Located nearest gas station.");
barlogger.debug("Exiting gas station search");