User Tools

Site Tools


java:setupaccesslogjboss7

Set up an access log in Jboss 7

https://community.jboss.org/message/634165

Create (if you don't have one) a directory called “WEB-INF” –in capital letters.

Inside, create a filename called jboss-web.xml with this content:

<?xml version="1.0"?>
<!DOCTYPE jboss-web PUBLIC
   "-//JBoss//DTD Web Application 5.0//EN"
   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
    <valve>
        <class-name>org.apache.catalina.valves.RemoteIpValve</class-name>
        <param>
            <param-name>protocolHeader</param-name>
            <param-value>x-forwarded-proto</param-value>
        </param>
    </valve>
    <valve>
        <class-name>org.apache.catalina.valves.AccessLogValve</class-name>
        <param>
            <param-name>prefix</param-name>
            <param-value>PUT YOUR FILENAME HERE.</param-value>
        </param>
        <param>
            <param-name>suffix</param-name>
            <param-value>.log</param-value>
        </param>
        <param>
            <param-name>pattern</param-name>
            <param-value>%h %l %u %t %r %s %b %{User-Agent}i %{JSESSIONID}c</param-value>
        </param>
        <param>
            <param-name>directory</param-name>
            <param-value>host</param-value>
        </param>
        <param>
            <param-name>resolveHosts</param-name>
            <param-value>false</param-value>
        </param>
    </valve>
</jboss-web>

Deploy again and the log file will be in JBOSS_HOME/bin/host instead of the log directory. A mistery…

java/setupaccesslogjboss7.txt · Last modified: 2014/12/24 10:42 (external edit)