by Minna Lunney
For logging SOAP-based requests, Envinsa provides powerful built-in configuration options accessible through the Enterprise Manager. REST API requests can also be logged, but this must be done through a separate mechanism: namely, by enabling access logging for the application server in use.
Here is an example of configuring access logging within Tomcat, the default application server for Envinsa.
1) Shut down the Tomcat that contains the REST service for which logging is desired.
2) Browse to the Tomcat’s conf folder, and open server.xml.
3) Scroll down to the Host element. Somewhere within the Host element, either add or uncomment a Valve element to define an access log. For example:
<Host name=”localhost” appBase=”webapps”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<!– Other items here –>
<Valve className=”org.apache.catalina.valves.AccessLogValve”
directory=”logs” prefix=”localhost_access_log.” suffix=”.txt”
pattern=”%t %s %b %D %r”/>
<!– Other items here –>
</Host>
The directory attribute specifies where to store the access log. The prefix and suffix attributes define what the beginning and end of the log file name should be. A timestamp will be automatically inserted in between (ex. localhost_access_log.2010-02-02.txt).
The pattern attribute holds a list of strings that define what information to record in each log entry. The pattern specified in the example above, when used in conjunction with the MapTiling service, produces a log entry that looks like this:
[02/Feb/2010:13:21:55 -0500] 200 79 516 GET /MapTiling/RESTService/getMaps?output=json HTTP/1.1
The available pattern strings are discussed here:
http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html
Additional attributes for the AccessLogValve class are discussed here:
http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html
4) Save and close server.xml.
5) Restart Tomcat.
For access logging in other commonly used application servers, please refer to the following resources.
WebLogic: http://download.oracle.com/docs/cd/E13196_01/platform/docs81/admin/admin.html#1072571
WebSphere: http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1//index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tcfg_intserver_access.html