Enabling Tomcat Access Logs

Add the following code snippet in the file $CATALINA_HOME/conf/server.xml. This will creates log files to track client access informations such as user session activity, user authentication information, page hit counts.

<Valve className=”org.apache.catalina.valves.AccessLogValve” directory=”logs”
prefix=”localhost_access_log.” suffix=”.txt” pattern=”common” resolveHosts=”false”/>

The code snippet states that the log file ‘localhost_acess_log.txt’ will be placed under $CATALINA_HOME/logs directory.

Restart the tomcat, its working.

Tags: , , , , , ,

2 Responses to “Enabling Tomcat Access Logs”

  1. Cristiano Says:

    How many log files rotated tomcat keep on disk?

  2. manikandanmv Says:


    Tomcat doesn’t delete the created log files. So it keeps on present in the log directory unless you run a script periodically to delete those files.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: