Wednesday, September 26, 2007

Logging request and response headers in Tomcat

What's the best way to dump out request or response headers in Tomcat?

Before rolling up your own solution, take a look at the valve component that Tomcat supports. In particular, the aptly named RequestDumperValve will log all the request and response headers in Tomcat. To enable the valve, just go to your server.xml file in the /conf directory and uncomment this line:

<Valve className="org.apache.catalina.valves.RequestDumperValve"/>

Then restart your server and the headers will appear in your log file.

2 comments:

Vinay said...

very useful information.
thnks

Anonymous said...

your the man cool-guy
see you at the beach