How to enable/disable Tomcat Access logs (logging of each ColdFusion request)

Sometimes, depending on your need, you may want to enable or disable the tomcat access logs, which track every request to ColdFusion. In CF10, these logs were enabled by default. In CF11, they are disabled by default. This post shows how to enable or disable them.

This can be simply done changing a setting a in <ColdFusion_Home>cfusionruntimeconfserver.xml file.

At the end of this xml file you may find the following commented tag.

<!–

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 

               prefix="localhost_access_log." suffix=".txt"

               pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false"/>

–>

To enable the logging, uncomment this tag as follows, and restart the server for the changes to be effective.

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 

               prefix="localhost_access_log." suffix=".txt"

               pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false"/>

If access logging is enabled, the logs are stored in {ColdFusion Root}cfusionruntimelogs.

Note that you can modify the attributes, such as the log filename (via the prefix attribute) and what is logged, via the pattern attribute. For more information on these and other attributes, and on Tomcat access logging in general, see https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Logging

Be aware that this feature logs EVERY request made to ColdFusion, and so these logs can grow quite large.

To disable the Tomcat access logs, sinply comment out the tag above (using 2 dashes for XML, rather than  CFML), and restart CF for that change to take effect.

One Response

Leave a reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.

Related