Re: Logging instead of connection.queries

2009-08-13 Thread Ivan Sagalaev
Hello! I'd like to revive the discussion about handling debug SQL log since I don't feel we've come to any conclusion. To summarize: - Ticket [5415] deals with implementing signals upon SQL queries. Nobody had any objections to it and it helps in solving my original problem of logging. - Mal

Re: Logging instead of connection.queries

2009-08-06 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > Unfortunately, this ticket doesn't solve Ivan's problem of the moment, > as far as I can see. Yeah, it sends signals in addition to maintaining connection.queries. My point (or one of them) is to replace current hard-coded implementation with something lower-level a

Re: Logging instead of connection.queries

2009-08-05 Thread Malcolm Tredinnick
On Tue, 2009-08-04 at 09:22 -0400, George Vilches wrote: [...] > > Putting signals on a replacement CursorWrapper would give the same > functionality from a user standpoint (the ticket outright says "This > will enable all sorts of interesting and useful things, such as > logging and debugging fu

Re: Logging instead of connection.queries

2009-08-04 Thread George Vilches
On Aug 3, 2009, at 6:53 PM, Malcolm Tredinnick wrote: > > On Mon, 2009-08-03 at 15:48 +0400, Ivan Sagalaev wrote: >> Hello! >> >> A couple of days ago a sudden thought has struck me while thinking on >> the matter of logging in Python libraries. I consider a good practice >> for a library to log

Re: Logging instead of connection.queries

2009-08-04 Thread Ales Zoulek
> I have a patch I've been holding over for 1.2 that reduces the current > > debug wrapper's log method to a ring buffer to avoid the accidental > > massive memory usage case. > > Actually this is not the main issue... I saw the discussion about > limiting the buffer. My main concern is that loggin

Re: Logging instead of connection.queries

2009-08-04 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > Adrian, in particular, has been historically against adding logger > module hooks in Django. So you have to work around that. Interesting... Adrian, can you elaborate? > I have a patch I've been holding over for 1.2 that reduces the current > debug wrapper's log metho

Re: Logging instead of connection.queries

2009-08-04 Thread Ivan Sagalaev
Russell Keith-Magee wrote: > For the record, there is one notable use for the legacy behavior - > debugging at the console. i.e., issue a query at the Python prompt, > then print connection.queries[-1] to see what was executed. Yes, and we can keep it. As I said a simple custom log handler can do

Re: Logging instead of connection.queries

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 15:48 +0400, Ivan Sagalaev wrote: > Hello! > > A couple of days ago a sudden thought has struck me while thinking on > the matter of logging in Python libraries. I consider a good practice > for a library to log what it's doing into a named logger without setting > up log

Re: Logging instead of connection.queries

2009-08-03 Thread Yuri Baburov
Hi Russell, On Mon, Aug 3, 2009 at 9:02 PM, Russell Keith-Magee wrote: > > On Mon, Aug 3, 2009 at 7:48 PM, Ivan Sagalaev > wrote: >> In this vein I propose to teach CursorDebugWrapper to log SQL queries >> into a named logger instead of storing them into connection.queries. >> Before writing a p

Re: Logging instead of connection.queries

2009-08-03 Thread Russell Keith-Magee
On Mon, Aug 3, 2009 at 7:48 PM, Ivan Sagalaev wrote: > > Hello! > > A couple of days ago a sudden thought has struck me while thinking on > the matter of logging in Python libraries. I consider a good practice > for a library to log what it's doing into a named logger without setting > up logging

Logging instead of connection.queries

2009-08-03 Thread Ivan Sagalaev
Hello! A couple of days ago a sudden thought has struck me while thinking on the matter of logging in Python libraries. I consider a good practice for a library to log what it's doing into a named logger without setting up logging by itself. It's then a responsibility of an application that w