[Python-ideas] Logging2 with default NullHandler

Niki Spahiev niki.spahiev at gmail.com
Thu Mar 15 13:24:34 CET 2012


On 14.03.2012 21:28, anatoly techtonik wrote:
> Badly need `logging2` module that has NullHandler assigned by default
> for all loggers.
> http://packages.python.org/Logbook/api/handlers.html#logbook.NullHandler
>
> Why? Because logging fails to play well with libraries:
>
>     import logging
>     log = logging.getLogger(__name__)
>     log.warn("WARN")
>
>     No handlers could be found for logger "spyderlib.utils.bsdsocket"
>
> What do I want from library logging as a Python application developer?
> Nothing until I explicitly setup default behaviour.
>
> logging can not be changed, and leaving everything as-is is a PITA,
> that's why I am
> proposing for logging2 as the only viable solution.

Can't this be solved with new function? e.g.
  log = logging.getLibLogger(__name__)

Niki




More information about the Python-ideas mailing list