> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Configure Jboss for writing web access logs
- URL: https://kudithipudi.org/how-to-configure-jboss-for-writing-web-access-logs/
- Published: 2012-03-14T03:08:33.000Z
- Updated: 2012-03-14T03:08:33.000Z
- Description: One of the capabilities of Jboss is that it can serve HTTP traffic. By default Jboss does not log any of the HTTP traffic in it’s...
- Author: admin
- Tags: HOWTO, Technology, Uncategorized, Web, #wp, #wp-post, #Import 2026-08-23 02:32

One of the capabilities of Jboss is that it can serve HTTP traffic. By default Jboss does not log any of the HTTP traffic in it’s log files. Here is a quick howto on enabling this logging. This post is specific to Jboss 4.x (ancient!!) and I will post another one soon on how do it in version 5.x and newer.

Edit the server.xml file located in $JBOSS\_HOME/servers/$PROFILE/deploy/jboss-web.deployer and replace the commented out access logger section as such

FROM

```
<!–
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_access_log." suffix=".log"
pattern="common" directory="${jboss.server.log.dir}"
resolveHosts="false" />
–>
```

TO

```
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_access_log." suffix=".log"
pattern="common" directory="${jboss.server.log.dir}"
resolveHosts="false" />
```

This will start creating a file with the format localhost\_access\_log.CURRENT\_DATE.log in the $JBOSS\_HOME/server/$PROFILE/log folder

But it isn’t fun if you just leave the default logging right :). The pattern formats of common and combined are similar to the standard apache logging options. But if you wanted to have certain content and format in the log files, you have a lot of options. Jboss community has documented all the data that is exposed through this valve at [http://docs.jboss.org/jbossweb/latest/api/org/apache/catalina/valves/AccessLogValve.html](http://docs.jboss.org/jbossweb/latest/api/org/apache/catalina/valves/AccessLogValve.html?ref=kudithipudi.org)

So say, I want to log the referrer header, user agent and the value of a cookie called JSESSONID and log all this data into a file called jboss\_web\_access\_log, I setup the options as such

```
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="jboss_web_access_log." suffix=".log"
pattern="%h %p %l %u %t %r %s %b ‘%{Referer}i’ ‘%{User-Agent}i’ ‘%{JSESSIONID}c’"
directory="${jboss.server.log.dir}"
resolveHosts="false" />
```