Lab 5: Using Valves

Objective: In this lab, you will configure an access log valve for your Tomcat instance that uses the "combined" Apache log format.

  1. Within the localhost host of your server.xml config, add an AccessLogValve that uses the "combined" pattern. Use "my_access_log" for the prefix and ".txt" for the suffix.
  2. Restart Tomcat so your changes take effect, then click around on several pages of your Tomcat instance.
  3. Go to the logs folder and verify you have a file named my_access_log.yyyy-mm-dd.txt that contains access events with the combined format:
    192.168.91.1 - - [10/Apr/2017:17:49:02 -0600] "GET /examples/websocket/drawboard HTTP/1.1" 101 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"