Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Robert Kern
If we're all converging on adding a handler of last resort and dropping the warning message, we can just let this branch of the thread drop. But if you want to continue, I already had most of the following already written. I hope it clears some things up more than it muddies them further. :-)

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Terry Reedy
On 12/8/2010 2:00 PM, Vinay Sajip wrote: Actually, I don't think my response to Nick's post (about concurrent.futures) could be characterized as I don't care, as I even made a specific proposal about how a change could be implemented. Your proposal struck me as probably the best way forward.

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Paul Moore
On 8 December 2010 19:04, Vinay Sajip vinay_sa...@yahoo.co.uk wrote: Paul Moore p.f.moore at gmail.com writes: On 8 December 2010 14:52, Nick Coghlan ncoghlan at gmail.com wrote: As I see it, there aren't many cases at the *library* level where logging errors is more appropriate than

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Vinay Sajip
Paul Moore p.f.moore at gmail.com writes: You misunderstand me. I know that's how those levels work. What I'm not sure about (and I think would be interesting and potentially useful information) is whether the individuals participating in this thread feel that liberal use of info and debug

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Glenn Linderman
On 12/8/2010 9:43 AM, Vinay Sajip wrote: offtopic As am off-topic example, Armin Ronacher kept on saying in various posts and presentations that you couldn't use stdlib logging for web applications, that there were fundamental problems with it. But when he actually sent me his specific problem

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-08 Thread Nick Coghlan
On Thu, Dec 9, 2010 at 4:49 AM, Paul Moore p.f.mo...@gmail.com wrote: On 8 December 2010 14:52, Nick Coghlan ncogh...@gmail.com wrote: As I see it, there aren't many cases at the *library* level where logging errors is more appropriate than raising exceptions: On a slightly tangential note,

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Antoine Pitrou
On Tue, 7 Dec 2010 20:26:06 + (UTC) Vinay Sajip vinay_sa...@yahoo.co.uk wrote: From my perspective and as mentioned in the logging documentation, library code which uses logging should add a NullHandler instance to any top-level logger, which will avoid any No handlers could be found

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Łukasz Langa
Wiadomość napisana przez Antoine Pitrou w dniu 2010-12-07, o godz. 21:50: If any library defining a logger must also add a NullHandler just in case, ISTM that complicates a lot the use of logging (and could explain its impopularity). Both for library writers and application writers,

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Antoine Pitrou
On Tue, 7 Dec 2010 22:04:36 +0100 Łukasz Langa luk...@langa.pl wrote: Wiadomość napisana przez Antoine Pitrou w dniu 2010-12-07, o godz. 21:50: If any library defining a logger must also add a NullHandler just in case, ISTM that complicates a lot the use of logging (and could explain its

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Eric Smith
On 12/07/2010 03:26 PM, Vinay Sajip wrote: I would suggest that when unit testing, rather than adding StreamHandlers to log to stderr, that something like TestHandler and Matcher from this post: http://plumberjack.blogspot.com/2010/09/unit-testing-and-logging.html This will allow assertion

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Łukasz Langa
Wiadomość napisana przez Antoine Pitrou w dniu 2010-12-07, o godz. 22:19: If you're writing an application then the No handlers could be found message is actually useful because there's hardly any reason no to include one. Why do you say that? Not having to add a handler is certainly

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Robert Kern
On 12/7/10 2:26 PM, Vinay Sajip wrote: This issue was brought to my notice today: http://bugs.python.org/issue10626 and reference was made in the comments to possible obstacles facing stdlib maintainers who might wish to use logging in the stdlib and in its unit tests. From my perspective

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Brett Cannon
On Tue, Dec 7, 2010 at 13:57, Eric Smith e...@trueblade.com wrote: On 12/07/2010 03:26 PM, Vinay Sajip wrote: I would suggest that when unit testing, rather than adding StreamHandlers to log to stderr, that something like TestHandler and Matcher from this post:

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Robert Kern
On 12/7/10 4:59 PM, Robert Kern wrote: On 12/7/10 2:26 PM, Vinay Sajip wrote: This issue was brought to my notice today: http://bugs.python.org/issue10626 and reference was made in the comments to possible obstacles facing stdlib maintainers who might wish to use logging in the stdlib and in

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Barry Warsaw
On Dec 07, 2010, at 04:59 PM, Robert Kern wrote: As a library author, I would dearly love to just add logging liberally without placing any additional burden to the users of my library. If my users wants to read those logs, he will configure logging. If he doesn't, he won't. With the current

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Antoine Pitrou solipsis at pitrou.net writes: I thought error and critical messages were logged to stderr by default? Isn't it the case? Only if you call basicConfig() or use the logging.debug(), logging.info(), etc. module-level convenience functions (which call basicConfig under the

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Robert Kern robert.kern at gmail.com writes: If I had my druthers, I would simply remove the No handlers could be found for logger XXX message. If we always wrote entire applications from the ground up, it makes a lot of sense. The person that writes the code that issues logs is the same

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Barry Warsaw barry at python.org writes: On Dec 07, 2010, at 04:59 PM, Robert Kern wrote: As a library author, I would dearly love to just add logging liberally without placing any additional burden to the users of my library. If my users wants to read those logs, he will configure

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Antoine Pitrou
On Tue, 7 Dec 2010 23:45:39 + (UTC) Vinay Sajip vinay_sa...@yahoo.co.uk wrote: Antoine Pitrou solipsis at pitrou.net writes: I thought error and critical messages were logged to stderr by default? Isn't it the case? Only if you call basicConfig() or use the logging.debug(),

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Eric Smith eric at trueblade.com writes: Wouldn't it make more sense to add these to test.support? I don't think we make any guarantees about its API being stable, although I have a faint recollection of that being debated in the past. That's what I mean when I said unit test

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Eric Smith
On 12/07/2010 07:09 PM, Vinay Sajip wrote: Eric Smithericat trueblade.com writes: Wouldn't it make more sense to add these to test.support? I don't think we make any guarantees about its API being stable, although I have a faint recollection of that being debated in the past. That's what

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Nick Coghlan
On Wed, Dec 8, 2010 at 10:09 AM, Antoine Pitrou solip...@pitrou.net wrote: On Tue, 7 Dec 2010 23:45:39 + (UTC) Vinay Sajip vinay_sa...@yahoo.co.uk wrote: Antoine Pitrou solipsis at pitrou.net writes: I thought error and critical messages were logged to stderr by default? Isn't it the

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Antoine Pitrou solipsis at pitrou.net writes: Why wouldn't it be the default for all logging calls ? Such special cases don't really make things easy to remember. One size doesn't fit all. Everything's documented reasonably well. If you use it often, you remember it. If you use it seldom,

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Barry Warsaw
On Dec 08, 2010, at 12:01 AM, Vinay Sajip wrote: Barry, if you mean +1 as in I agree this is how it should work, then we're all agreed. Yep, that's what I meant! -Barry signature.asc Description: PGP signature ___ Python-Dev mailing list

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Vinay Sajip
Nick Coghlan ncoghlan at gmail.com writes: Indeed - I was very surprised to find just now that calling logging.warn('Whatever') is not the same as doing log = logging.getLogger(); log.warn('Whatever'). Don't know why you'd be surprised: it's been that way since logging was added to Python,

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Robert Kern
On 2010-12-07 17:58 , Vinay Sajip wrote: Robert Kernrobert.kernat gmail.com writes: If I had my druthers, I would simply remove the No handlers could be found for logger XXX message. If we always wrote entire applications from the ground up, it makes a lot of sense. The person that writes

Re: [Python-Dev] Using logging in the stdlib and its unit tests

2010-12-07 Thread Nick Coghlan
On Wed, Dec 8, 2010 at 11:51 AM, Vinay Sajip vinay_sa...@yahoo.co.uk wrote: Nick Coghlan ncoghlan at gmail.com writes: Indeed - I was very surprised to find just now that calling logging.warn('Whatever') is not the same as doing log = logging.getLogger(); log.warn('Whatever'). Don't know

<    1   2