I actually wasn't on this list, so didn't see this and some other
emails.
Mike Orr wrote:
> One problem with paste.translogger is it logs all the error documents,
> which is nifty for ten minutes but then becomes clutter unless you're
> debugging the error documents themselves. This is a basic problem for
> new Pylons users who need a transaction log that shows only
> user-originated requests, and they don't want to spend hours
> reimplementing it.
>
> I tried to subclass TransLogger to ignore error URLs, but it's not
> very subclassable. i got this:
>
> ====
> class TransLogger(_TransLogger):
> format = ('%(REMOTE_ADDR)s - %(REMOTE_USER)s [%(time)s] '
> '"%(REQUEST_METHOD)s %(REQUEST_URI)s %(HTTP_VERSION)s" '
> '%(status)s %(bytes)s "%(HTTP_REFERER)s"')
>
> def __init__(self, application, ignore_prefixes=None, **kw):
> self.ignore_prefixes = ignore_prefixes or []
> _TransLogger.__init__(self, application, **kw)
>
> def write_log(self, environ, req_uri, start, status, bytes):
> if self.ignore(req_uri):
> return
> _TransLogger.write_log(self, environ, req_uri, start, status, bytes)
>
> def ignore(self, req_uri):
> for prefix in self.ignore_prefixes:
> if req_uri.startswith(prefix):
> return True
> return False
I think using the url path is bad, but there are better ways. Ideally
errordocument would leave something in the environ that shows that the
request is a subrequest, and thus shouldn't be logged. Ideally
everything that is a subrequest would do this. There isn't a single
clear entry point for subrequests; paste.recursive is kind of icky,
and even I (is it "even" for me?) haven't been using it lately in lieu
of just making direct calls.
I'd support a clear way of indicating what is a subrequest, probably
with a pointer to the original request.
Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---