Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35796

Re: Confused about logger config from within Python (3)

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Confused about logger config from within Python (3)
Date 2012-12-29 20:08 -0500
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-58EC9B.20081429122012@news.panix.com> (permalink)
References <a51d0c8a-adc9-4d8e-b3cc-affd7c6aad95@googlegroups.com> <3149c22d-ae6d-43b4-8f88-3cc5fa91094c@googlegroups.com> <50de7a0a$0$29967$c3e8da3$5496439d@news.astraweb.com> <roy-DE6FD3.08481229122012@news.panix.com> <mailman.1455.1356826759.29569.python-list@python.org>

Show all headers | View raw


In article <mailman.1455.1356826759.29569.python-list@python.org>,
 Terry Reedy <tjreedy@udel.edu> wrote:

> On 12/29/2012 8:48 AM, Roy Smith wrote:
> > In article <50de7a0a$0$29967$c3e8da3$5496439d@news.astraweb.com>,
> >   Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
> >
> >> In Python 3.2 and 3.3, the message about no handlers is not printed,
> >> which is an interesting difference. (Somebody who knows more about the
> >> logging package than I do might be able to state why that difference.)
> >
> > I hope that means that http://bugs.python.org/issue994421 has finally
> > been fixed :-)
> 
> I added an update ;-).
> 
> If Vijay wanted the message to be a warning rather than an exception, 
> the warnings module and mechanism could have been used (once it was 
> available -- I am not sure when that was). But I think a default handler 
> is even better.

Having a default handler is clearly a good fix.

> I also hope you appreciate that Vijay has stuck with maintenance and 
> upgrade of the module for nearly a decade now.

Absolutely.

BTW, I recently discovered a truly awesome thing about logging and 
nosetests.  Apparently, nose attaches a hander to the root logger at 
debug level and buffers anything that gets sent there.  If a test fails, 
it prints anything that logger captured.  So, for example (intentionally 
breaking one of my tests):

-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP 
connection (1): localhost.lic.songza.com
requests.packages.urllib3.connectionpool: DEBUG: "GET 
/foo:80/api/v2/?format=json ('HTTP/1.1',)" 404 None
--------------------- >> end captured logging << ---------------------

This rocks!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 11:57 -0800
  Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 16:41 -0800
    Re: Confused about logger config from within Python (3) Peter Otten <__peter__@web.de> - 2012-12-29 01:56 +0100
      Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 18:29 -0800
        Re: Confused about logger config from within Python (3) Dave Angel <d@davea.name> - 2012-12-28 22:02 -0500
      Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 18:29 -0800
    Re: Confused about logger config from within Python (3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-29 05:05 +0000
      Re: Confused about logger config from within Python (3) Roy Smith <roy@panix.com> - 2012-12-29 08:48 -0500
        Re: Confused about logger config from within Python (3) Terry Reedy <tjreedy@udel.edu> - 2012-12-29 19:18 -0500
          Re: Confused about logger config from within Python (3) Roy Smith <roy@panix.com> - 2012-12-29 20:08 -0500
  Re: Confused about logger config from within Python (3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-29 04:31 +0000

csiph-web