Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have Tomcat instance running on Ubuntu server. It runs a web service, open to the internet.

Sometimes it has a sudden spike of traffic and goes down. There is nothing unusual in Tomcat access logs. I guess it is because some of the requests are so 'heavy' that they never finish and hence are not recorded to Tomcat access logs.

Is there a way to configure Tomcat to log incoming requests before they are executed? Each request should be logged in the following format

Date, Time, URL (with query string params), IP address (of client)

There should be one line per request. Only incoming requests to ports 80 and 443 should be logged.

share|improve this question
up vote 1 down vote accepted

Tomcat's AccessLogValve has the buffered configuration option which defaults to true, which means that if Tomcat crashes, you might lose the buffer's worth of logs. See

You might want to try and set buffered to false, which would then make the valve flush the log on every request, bearing in mind that this will probably affect overall performance.

Another option is to place e.g. an Apache reverse proxy in front of Tomcat (using mod_proxy, mod_jk, mod_ajp or mod_cluster) and have it do the request logging.

share|improve this answer
Thank you for the reverse proxy idea! – Maxim Eliseev Jul 3 '13 at 9:25
-1 for the AccessLogValve - I confirmed it only logs after the request is completed, either buffered or not. But +1 for the reverse proxy idea. – kubanczyk Nov 8 '15 at 12:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.