Re: The basics of the logging module mystify me

2018-04-20 Thread Skip Montanaro
> I've no idea what setting log.level does; I would normally use > logging.basicConfig to set that sort of thing. > > logging.basicConfig(level=logging.INFO) The log.level setting is what calling log.setLevel(...) does under the covers. What neither apparently do is have any effect on whatever han

Re: The basics of the logging module mystify me

2018-04-20 Thread Ian Pilcher
On 04/19/2018 04:52 AM, Thomas Jollans wrote: Or, more often than not, it's best to use the logging module's configuration system that creates the right web of handlers and formatters for you. Wow! This is the first I've heard of logging.config (although it's easy to find now that I know that

Re: The basics of the logging module mystify me

2018-04-20 Thread Albert-Jan Roskam
On Apr 19, 2018 03:03, Skip Montanaro wrote: > > > I really don't like the logging module, but it looks like I'm stuck > with it. Why aren't simple/obvious things either simple or obvious? Agreed. One thing that, in my opinion, ought to be added to the docs is sample code to log uncaught except

Re: The basics of the logging module mystify me

2018-04-19 Thread Thomas Jollans
On 2018-04-19 03:00, Skip Montanaro wrote: > This session is from Python 3.6.5 on Linux: > import logging log = logging.getLogger() log.level > 30 logging.WARN > 30 log.warn("Awk! Goodbye...") > Awk! Goodbye... log.level = logging.INFO log.info("Awk! Goodbye...")

Re: The basics of the logging module mystify me

2018-04-19 Thread Paul Moore
On 19 April 2018 at 02:00, Skip Montanaro wrote: > I really don't like the logging module, but it looks like I'm stuck > with it. Why aren't simple/obvious things either simple or obvious? If you can use non-stdlib things there are alternatives. I've heard good things about logbok (https://logboo

Re: The basics of the logging module mystify me

2018-04-18 Thread Chris Angelico
On Thu, Apr 19, 2018 at 11:00 AM, Skip Montanaro wrote: > This session is from Python 3.6.5 on Linux: > import logging log = logging.getLogger() log.level > 30 logging.WARN > 30 log.warn("Awk! Goodbye...") > Awk! Goodbye... log.level = logging.INFO log.info("Awk!

The basics of the logging module mystify me

2018-04-18 Thread Skip Montanaro
This session is from Python 3.6.5 on Linux: >>> import logging >>> log = logging.getLogger() >>> log.level 30 >>> logging.WARN 30 >>> log.warn("Awk! Goodbye...") Awk! Goodbye... >>> log.level = logging.INFO >>> log.info("Awk! Goodbye...") >>> log.level 20 >>> log.level == logging.INFO True >>> log