Is there a way to log HTTP post data in JBoss 7.1.1?

11,213

You can configure http access logging in the web subsystem of standlone.xml or domain.xml files.

Here is an example:

<subsystem xmlns="urn:jboss:domain:web:1.0" ....>
    <connector name="http" ... />
    <virtual-server name="default-host" enable-welcome-root="true">
        <whatever aliases you may have defined />
        <access-log>
            <directory relative-to="jboss.server.log.dir"/>
        </access-log>
    </virtual-server>
</subsystem>

or you can use the CLI (recommended - use the tab complete feature to find out available attributes):

/subsystem=web/virtual-server=default-host/access-log=configuration:add(whatever-attributes-you-want-for-access-log)

UPDATE based on the comment from OP below

If you want to track the HTTP request content then you will need to enable RequestDumperValve. In JBossAS7 you can not enable this globally (unlike AS5 or AS6)/. You have to enable it on a per deployment basis. Add this line in WEB-INF\jboss-web.xml file:

<valve>
        <class-name>org.apache.catalina.valves.RequestDumperValve</class-name>
</valve>

You do not need the access log enabled for the valves, it will output the info in the server.log file. You can read more about RequestDumperValve. You may also be interested in RequestFilterValve.

These valves are generally used for debugging purposes though and not in production usage. So do keep that in mind as they are quite verbose. Alternatively you can look at tools like WireShark or Fiddler. If you really want to dig even deeper TCPDumps would be the way to go (word of caution - they are quite big and complicated to analyze).

Hope this helps!

Share:
11,213
JustinKSU
Author by

JustinKSU

Java Code Monkey #SOreadytohelp

Updated on August 21, 2022

Comments

  • JustinKSU
    JustinKSU over 1 year

    Is there a way to log HTTP post data in JBoss 7.1.1?

    Is there a class you set to DEBUG in the logging configuration that will output this?

  • JustinKSU
    JustinKSU over 11 years
    Adding the <access-log/> creates a log of when a POST occurs, but I want to actually view the post content. The best I have come up with is adding a Servlet Filter, but once I do that then I can't pass along the post parameters to the target Framework Servlet. I was hoping that JBoss had a way to log the traffic as it's being piped to the web application? Any chance of this?
  • CoolBeans
    CoolBeans over 11 years
    @JustinKSU - Sure added more info in the post to answer your comment. HTH.
  • JustinKSU
    JustinKSU over 11 years
    Exactly what I was looking for. I apologize for not being more clear in my original post.
  • CoolBeans
    CoolBeans over 11 years
    @JustinKSU - No problem. I am glad it helped you. Happy JBoss-ing!
  • Marek Gregor
    Marek Gregor over 10 years
    RequestDumperValve could be enabled globally by following configuration snippet in standalone.xml (in <subsystem xmlns="urn:jboss:domain:web:1.4"...>): <valve name="RequestLogging" module="org.jboss.as.web" class-name="org.apache.catalina.valves.RequestDumperValve"/>
  • CoolBeans
    CoolBeans over 10 years
    @MarekGregor - yes they added the global valve support back in a later release. It was not there initially.