How to enable access logging for JBoss EAP 6?

Solution Verified - Updated -


  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x


  • Activate instant http request access logging to file for the web subsystem
  • Access logs not generating.
  • Convert this configuration from an earlier version

    <Valve className="org.apache.catalina.valves.AccessLogValve" 
                    prefix="localhost_access_log." suffix=".log"
                    pattern="common" directory="${jboss.server.log.dir}" 
                    resolveHosts="false" />
  • Access log file shows false2015-11-11

  • Create access logs with different name format.


DISCLAIMER: Links contained herein to external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.

This solution is part of the [Master] Configuring Access Logs in Red Hat Middleware Products..

By default there is no web logging enabled. In JBoss EAP 6, access logging can be configured per web application, or by virtual-server of the web subsystem.

Per Web Application Setting

Configure AccessLogValve setting in WEB-INF/jboss-web.xml to enable access logging for a web application. For example:

                <!-- use pattern letters defined in SimpleDateFormat.
                    This fileDateFormat setting affects to log rotation cycle
                <!-- default setting: daily -->
                <!-- hourly
                <!--  use constant text or replacement strings defined in 
           to pattern tokens.
                <!-- default setting: common (%h %l %u %t "%r" %s %b) -->
                <!-- combined (%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i") 
                <!-- combined + response time
                <param-value>%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i TimeTaken: %T </param-value>
                <!-- combined + Session ID + Response time 
                <param-value>%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i SessionID: %S TimeTaken: %T</param-value>

Note: This can be enabled/disabled by changing the above config and redeploying the application.

Via WebSubsystem

Run the following CLI commands standalone.xml. Prefix all commands with /profile=MYPROFILE for domain.xml. Restart the server for this to take effect.

    /subsystem=web/virtual-server=default-host/configuration=access-log:write-attribute(name="pattern",value="%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i Cookie: %{COOKIE}i Set-Cookie: %{SET-COOKIE}o SessionID: %S Thread: %I TimeTaken: %T ")

Note Don't leave off the prefix because it will end up adding false.

This will result in:

    <access-log pattern="%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i Cookie: %{COOKIE}i Set-Cookie: %{SET-COOKIE}o SessionID: %S Thread: %I TimeTaken: %T" prefix="access_log_"/>

By default, access logging is output under ${jboss.server.log.dir}/default-host i.e. under $JBOSS_HOME/standalone/log/default-home, but it's possible to change the directory:


This will result in the following XML:

        <path name="my.log.dir" path="/mnt/log/jboss"/>
    <subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">
        <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
        <virtual-server name="default-host" enable-welcome-root="true">
            <alias name="localhost"/>
            <alias name=""/>
            <access-log pattern="%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i Cookie: %{COOKIE}i Set-Cookie %{SET-COOKIE}o SessionID: %S Thread: %I TimeTaken: %T" prefix="access_log_">
                <directory path="${}-accessLog" relative-to="my.log.dir" />

This would output access log under /mnt/log/jboss/my-access-log, please configure the following <directory> and <paths> setting. Leave off the directory settings if the default path is required.

Since JBoss Web is based on Apache Catalina, check AccessLogValvepage in Apache Tomcat documentation for more arguments to use.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.