I'm trying to be a good boy and use the logging module but it's
behaving rather counter-intuitively. I've posted a simplified test
script below.
To summarize, I've set the basic config to only log root level messages
with >= ERROR level. I've created another named logger that logs on
info level. I've set it up so it just shows the message text without
"INFO:: logger:" boilerplate.
The way I see things, when I call otherLogger.inf o, it should propogate
the message to the root logger, but the root logger should discard it
since it is at ERROR level.
Could someone explain what I'm not getting?
-Grant
###
### logging_test.py
###
import logging
logging.basicCo nfig(level=logg ing.ERROR)
root = logging.getLogg er('')
otherLogger = logging.getLogg er("logger")
otherLogger.set Level(logging.I NFO)
console = logging.StreamH andler()
console.setLeve l(logging.INFO)
formatter = logging.Formatt er("%(message)s ")
console.setForm atter(formatter )
otherLogger.add Handler(console )
root.info("Shou ldn't print") # lower level
root.error("Sho uld Print") #higher level
otherLogger.inf o("Should only print once")
root.info("Shou ldn't print") # lower level