Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a packet hits tomcat

Is it possible to check if any request has hit the Tomcat? something similar to access.log of Apache server. I am using Tomcat 6.

like image 994
ihavprobs Avatar asked Dec 27 '22 19:12

ihavprobs


1 Answers

Apache Tomcat provides the configuration directory conf, that contains the file server.xml. At the bottom of this file, a line that includes the adjustments valve, called AccessLogValve must be un-commented and changed.

The default valve parameters and patterns can easily be modified, either through an editor, or by an application. This is a reasonably detailed log file that can be used for access metrics:

<Valve
   className="org.apache.catalina.valves.AccessLogValve."
   directory="logs"
   prefix="sitename_acc."
   suffix=".log"
   pattern='%a %A %b %B %h %l %m %p %q %u %t "%r" %s %U %D %S'
   resolveHosts="false"
   rotatable="true"
   fileDateFormat="yyyy-MM-dd"
/>

You can even have multiple tomcat instances running at the same time, each with it's own access log file.

like image 80
Costis Aivalis Avatar answered Jan 07 '23 22:01

Costis Aivalis