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

Glenn Linderman v+python at g.nevcal.com
Thu Dec 9 01:50:48 CET 2010

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 statement, I gave him a solution without spending too much time
> on it (see
> http://plumberjack.blogspot.com/2010/09/configuring-logging-for-web.html  if you
> care). I'm not trying to be obstructive, honestly.
> </offtopic>

Since my application is also web server related, I was curious enough to 
look at this blog posting to see if it would be a good starter example 
that is missing from the manual.  I don't think it is, as it is somewhat 
complex, although it is multi-module, and even multi-thread, so it might 
make a good example for other parts of the documentation (but maybe they 
already have good examples; I've only looked at the first 8%).

In trying to understand it, I couldn't figure out why the WebApp class 
needs to keep track of the threads that are running the that web app.  
Why isn't it good enough for the thread to know the name of the app?  
The filter copies the appName from the thread to the record; the 
InjectingFilter.filter not replace

         record.appName  =  tlocal.appName
         tname  =  threading.currentThread().getName()
         return  tname  in  self.app.threads


	record.appName = tlocal.appName
	return appName == self.app.name

and get the same effect, without needing to mainting the self.threads "database"?

Or what am I missing?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101208/bebf354b/attachment.html>

More information about the Python-Dev mailing list