This is third in my series of posts detailing my efforts to stand up a Tomcat/ACF10 development environment next to my existing Apache/JRun/ACF9 stack. For background, see the first post in the series.
Access logging in Tomcat is fairly straightforward to set up, and the official docs are very understandable. The default configuration installed with ACF10 includes an entry for access logging in
./cfusion/runtime/conf/server.xml. Toward the bottom of the file, find the
<Host> element and its child access log
<Host name="localhost" ... > <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/tmp" prefix="access-" suffix=".log" pattern="common" rotatable="true" fileDateFormat="yyyy-MM-dd" /> ... </Host>
Most of what’s shown there is easy to understand. A couple of items are worth touching on:
patternattribute specifies what gets logged for each request; as noted in the docs “common” and “combined” are short-cuts for standard sequences of commonly-used field
fileDatePatternattribute is used to specify the naming mask for the log file; it also specifies the frequency at which the log files are rotated if the logs are specified as being rotatable. Where this mask goes to the day level, access logs will be specified each day.
- I’ve temporarily set up the access logs to be created in the
/tmpfolder just for convenience as I work through configuring; I will change this to have the logs created in a more standard (and more secure) location as I get closer to wrapping this up.
Configure your logs as needed, restart the server, bounce a couple requests off it, and verify that the access logs are present and functional.