Am Dienstag, 6. November 2007 07:00 schrieb Matti Haavikko:
> Here's an alternative solution - it's based on the idea that the
> handlers are added to the logger only once. (getLogger returns the same
> logger instance each time).
>
> import logging
> logger=logging.getLogger("dws")
> if not logger.handlers:
>     ...
>     logger.addHandler(....)

Hi,

I used something like this, but used the root logger (getLogger()).

If there is a call to logging.log(...) before you add your handler,
python automatically inserts one for you. This means the if-statement
above will be false (and addHandler() would not be called), even on the first 
run.

 Thomas



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to