Dynamo includes a formatting file logger component that can be set to log page requests from users, /atg/dynamo/service/logging/RequestLogger. The RequestLogger logs properties of the request and response objects for each user request, which it obtains from the DynamoServlet. To use the RequestLogger, set the dataListeners property of /atg/dynamo/servlet/pipeline/DynamoServlet as follows:


You can set the dataListeners property using the Event tab in the Component Editor:

The RequestLogger has the following properties file:


# directory and file name

formatFields=request.remoteAddr,' - - [',currentDate:d/MMM/yyyy:H:mm:ss,']
  "',request.method,' ',request.requestURI,' ',request.protocol,'"
  ',response.status,' -'

# the default field delimiter is a tab char ('\t')
# in this example we set it to null as our formatFields
# above include custom field delimiters

The $class line loads the FormattingFileLogger class, which formats data items and logs them to a file. The logFileDir and logFileName properties control the file you log to.

The key property to look at here is formatFields. This is an ordered list of the properties to log. In this example, the RequestLogger is expecting data items that have properties named request.remoteAddr, request.method, request.requestURI, request.protocol, and response.status. The RequestLogger gets this data from the request and response objects. By default, fields are delimited by tabs and terminated by newlines. However, the formatFields property in this example provides custom field delimiters. One line in the log is written for each data item that the logger receives. To log just the requestURI, change the formatFields property to:


This writes to the logs/request.log file, entering the request.requestURI of each data item followed by a newline.

loading table of contents...