On Wed, May 27, 2009 at 10:23 AM, Valery Khamenya <khame...@gmail.com>wrote:

> Hi Karen,
>
> thanks for reply. I am looking in log files that I believe are created by
> apache, at least they are created via usual apache statement like:
>
>  ...
>  CustomLog /var/www/mysite/logs/access.log combined
>  ...
>
> In this sense, yes, I do see only a single HTTP-request in logs, but can
> track multiple calls.
>
> How can I register those multiple calls? Easily, I send only one single
> email notification per veiw function call, but I receive multiple emails
> after one HTTP-request.
>

So I'd probably debug by adding logging.  Specifically something like this:

        print >> sys.stderr, "WSGIHandler called to handle request;
environ=%r" % environ

to django/core/handlers/wsgi.py as the first line in the __call__ method for
WSGIHandler.  Each resulting entry you see in the Apache error log indicates
Django was called by Apache to handle a request, and the PATH_INFO key in
the environ will show what the request is for, exactly.

Similarly add logging to where you send the email.  Issue your single
request and check the access and error logs for where the duplication is
happening.

If you get multiple email send logs for a single WSGIHandler __call__ then
it's resulting from within Django or your code, and you can head down the
path of logging the call stack at the email send point, or adding more
logging along the execution path, to figure out what's going on.

If you get multiple WSGIHandler __call__ logs for a single entry in access
log, then it's something outside of Django that is causing the problem.  I
have no idea how that would be happening.

If you get a single WSGIHandler __call__ log and a single email send log,
but multiple emails, then something is duplicating the sent emails, or there
is somewhere else in your code sending emails.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to