On 21/10/2005, at 2:41 AM, Nic Ferrier wrote:


There is one remaining problem that I am aware of. When you do:

   logger = logging.getLogger("webapp")

you are always gauranteed to get the same logger. That's bad in a
multi-programming environment.

The traditional approach to this is to create your logger with a
unique name, eg:

   logger = logging.getLogger("webapp" + thread_id)

But clearly we'd be relying on users to do that.

I could come up with a logging factory to mitigate that.

Needs to be based on more than thread ID. An internal redirect can
cause a new request handler to be triggered using the same thread.
Thus, rather than thread ID, it probably needs to be the Python ID of
the request object, ie., id(req).

This should work as a new request object is created for the internal
redirect.

Graham

Reply via email to