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: The following information has been provided by Red Hat, but is outside the scope of the posted Service Level Agreements and Scope of Coverage. Red Hat does not support software contained in the EPEL repository, or other third-party repositories, or from third-party non-Red Hat sources. The information is provided as-is without representations or warranties about the suitability or accuracy of the information provided. The intent is to provide information to accomplish the system's needs. Use of the information below is at the user's own risk.

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:

                <!-- You can use pattern letters defined in SimpleDateFormat.
                    This fileDateFormat setting affects to log rotation cycle
                <!-- default setting: daily -->
                <!-- hourly
                <!-- You can 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.

  • For the whole web subsystem

    Run the following CLI commands standalone.xml. Prefix all commands with /profile=MYPROFILE for domain.xml. You well need to restart 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 you can 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. You can leave off the directory settings if you want the default path.

Since JBoss Web is based on Apache Catalina, you can 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.


I am running JBoss in a container. I would like send the access logs to console/system log instead of directory as shown below. Is it possible ?


               <access-log pattern='%h %l %u %t %r %s %b %{Referer}i %{User-Agent}i %S %T'>
                   <directory path="${}-accessLog" relative-to="jboss.server.log.dir" />

Hello, can you update for EAP 7 too? Thanks, Gianluca

thanks for the link to the new KCS, both you and Masanobu

Hello, can you check this KCS for EAP7?