Logging request headers

If you are having trouble authenticating to JIRA or a web application, it can be useful to log the details of all HTTP request headers that are being sent to the web application. If your application server is Tomcat, you can do this with the Request Dumper Valve.

Add the following entry to the <Engine> section of your Tomcat conf/server.xml file:

Then restart JIRA.

You will get lots of entries like the following in your logs/catalina.out log file:

12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=user-agent=Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.6) Gecko/20071008 Ubuntu/7.10 (gutsy) Firefox/2.0.0.6
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=accept=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=accept-language=en-us,en;q=0.5
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=accept-encoding=gzip,deflate
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=accept-charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=keep-alive=300
12/11/2007 16:27:06 org.apache.catalina.valves.RequestDumperValve invoke
INFO:             header=connection=keep-alive

Was this helpful?

Thanks for your feedback!

2 Archived comments

  1. User avatar

    Eirik Lygre

    This is no longer correct. From Tomcat 7 onwards, use the following inside conf/server.xml:

    The logging is still much the same (smile)

    01 Feb 2014
  2. User avatar

    Alan Hohn

    Eirik: Thanks, this was helpful.

    Note that the filter should be configured in conf/web.xml rather than conf/server.xml.

    Also, careful when copying/pasting to make sure non-standard whitespace don't get pulled in around the class name - the symptom would be a ClassNotFoundError on the filter class with unexpected control characters printed in the error message.

     

    17 Aug 2015
Powered by Confluence and Scroll Viewport