Google Groups Home
Help | Sign in
tools.log_headers broken?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Shawn  
View profile
 More options Jun 24, 10:18 pm
From: Shawn <binarycrusa...@gmail.com>
Date: Tue, 24 Jun 2008 19:18:53 -0700 (PDT)
Local: Tues, Jun 24 2008 10:18 pm
Subject: tools.log_headers broken?
It seems as if tools.log_headers only works for error conditions.

I'm doing this for my app:

         cherrypy.config.update({
            "tools.log_headers.on": True
        })

However, I'm not seeing headers going to the log for every request.

A further glance reveals that it is only hooked to
before_error_response:

_d.log_headers = Tool('before_error_response',
cptools.log_request_headers)

Changing _cptools.py to:

_d.log_headers = Tool('on_start_resource',
cptools.log_request_headers)

...seems to do the trick, but this seems wrong.

http://www.cherrypy.org/wiki/BuiltinTools says:

tools.log_headers
When enabled, the headers of every request will be sent to CherryPy's
log.

Have I missed something?

-Shawn


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Brewer  
View profile
 More options Jun 25, 12:15 pm
From: "Robert Brewer" <fuman...@aminus.org>
Date: Wed, 25 Jun 2008 09:15:59 -0700
Local: Wed, Jun 25 2008 12:15 pm
Subject: RE: [cherrypy-users] tools.log_headers broken?

All I can say is, "it's always been on-error only". I've updated the
wiki page. You're certainly welcome to run the log_request_headers
function at a different hookpoint--this is one of the strengths of the
hook and tool system, not wrong at all! I'd just recommend you make a
new Tool for yourself instead of monkeypatching:

    cherrypy.tools.log_all_headers = cherrypy.Tool(
        'on_start_resource', cptools.log_request_headers)

Robert Brewer
fuman...@aminus.org


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shawn  
View profile
 More options Jun 25, 3:49 pm
From: Shawn <binarycrusa...@gmail.com>
Date: Wed, 25 Jun 2008 12:49:40 -0700 (PDT)
Local: Wed, Jun 25 2008 3:49 pm
Subject: Re: tools.log_headers broken?
On Jun 25, 11:15 am, "Robert Brewer" <fuman...@aminus.org> wrote:

Yes, I already ended up using a custom tool to do this.

The documentation just didn't jive with the code.

Thanks,
-Shawn


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google