On Mon, 2007-03-26 at 20:22 -0500, Jeremy Dunck wrote: > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > I > > did an experiment early last year to put in calls to the python logging > > module throughout various paths in Django. It had a noticeable impact. > > I had this on my list of things to do at some point. I'm not arguing > to add logging here, but just generally, were you measuring with > memory buffering and/or with the logger level higher than most log > messages? I had thought a LOGGER_THRESHOLD setting would skip most of > the cost. But perhaps just the function dispatching added up?
It was the function calls -- even doing nothing is not free and you could see it showing in the profiles. Having an actual logger in place (so that it checks the level each time) had a slightly larger impact. I mean, it didn't bring the system to a halt, but it was enough that I wouldn't have felt comfortable in production (my memory says around 10% hit, but that sounds way too high, so I think I'm getting that confused with some other half-assed experiments I did at the time). The memory buffering question is interesting. I just realised I have a prejudice there that probably interfered: in most cases where I need Python logging, anything other than persistent logging is inappropraite. So I was doing my measuring with logging to disk. Might be more of an argument for memory buffering in this case, though, for people just wanting to debug simple problems. I was trying to make it easier for people to track template parsing and query construction, so those were the two paths I instrumented. It's not a hard change to make, by the way -- dropping in logging calls in a few places isn't hard -- so don't let my attempt put off any attempts you want to make. It was something I tooled around with on a Saturday afternoon in preference to fixing real bugs at the time. I still have a note to go back and look at this again at some point, because it would be useful at some level. There's a lot of playing around to do with how much logging is put in place: finding the balance between utility and performance is the trick, obviously. Cheers, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---