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. Since CF11, they are disabled by default. This post shows how to enable them, as well as how to modify the logging.
[Originally posted on 7/26/15; updated 7/21/21, to correct a problem of missing slashes, improve some formatting, update Tomcat docs link]
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. Since CF11, they are disabled by default. This post shows how to enable them, as well as how to modify the logging.
Enabling/disabling the logs
This can be simply done changing a setting a in <ColdFusion_Home>cfusion/runtime/conf/server.xml file. (If running multiple instances, use instancename instead of cfusion.) Before making changes, save a copy of the file.
At the end of this server.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 "%r" %s %b” resolveHosts=”false”/>
–>
To enable the logging, make a copy of the file, then remove the comments. To disable the logging, instead simply comment out the tag, as above (noting the use of two dashes for an XML rather than a CFML comment).
After making the changes, save the file and restart ColdFusion for the changes to take effect.
Do beware that this feature logs EVERY request made to ColdFusion, and so these logs can grow quite large.
Viewing the access log
When enabled, the logs are stored in <ColdFusion_Home>cfusion/runtime/logs (or instancename instead of cfusion).
Modifying the logging
Note finally that you can modify the logging in two ways, by changing attributes within that valve tag above.
First, you can modify the log filename (via the prefix attribute). Second, you can modify what characteristics about each request 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-9.0-doc/config/valve.html#Access_Logging