Having control over the order of fields lets you configure a formatting logger to write files suitable for post-processing or bulk data loading into an SQL database. You can implement more advanced formatting, such as changing the delimiter or terminator. You can also create a logger that emits data formatted in XML.

The following properties of the FormattingFileLogger component control the contents of log fields and fields:


This property is an ordered list of the properties to log, taken from the incoming data item. Each item in the list represents a single field in a line of formatted text in the log file. Separate each item with a comma. For example:


Remember that Java properties files treat white space as part of the property value. Set the formatFields property like this:


and not like this, with white space between the comma separator and the field name:

formatFields=name, address.number, address.streetName

Note: As shown in the example above, you can log subproperties, such as address.streetName.

Formatting Individual Fields (Dates)

By default, each property of a data item is converted to a string by calling the standard toString() method. This is usually what is expected and desired. However, sometimes it is not the right thing. For instance, Date objects often require special formatting.

To handle this, format fields can have format strings. To use a format string, specify the property name, followed by a colon and the format string. Here is an example that shows how Dynamo’s RequestLogger component (/atg/dynamo/service/logging/RequestLogger) logs the currentDate property:


If a format string is present, the field is formatted using that string and the JSDK standard java.text formatting facility. Currently, this formatting is only supported for java.util.Date objects. If you have a property to format in a certain way, you can make that property be a class and override its toString() method.

Note, however, that formatting a date can be an expensive operation. If logging performance is an issue, consider storing date or timestamp information as a long primitive.

For Date objects, possible formats are those supported by the java.text.SimpleDateFormat of the JSDK you are using. See the documentation for your JSDK at, for example, <JSDK dir>/jdoc/java/text/SimpleDateFormat.html . The Dynamo formatting loggers use this date format by default:

yyyy-MM-dd HH:mm:ss


By default, a formatting logger delimits fields with tabs. You can specify a different separator with the fieldDelimiter property. For example, to use the colon ( : ) as a delimiter, you can set the following property:


You might want to have a different delimiter for each field. You can set the fieldDelimiter property to null and set the delimiter for each field in the value of the formatFields property, using single quotes to add labels to each line of the log, as in this example:

formatFields='RemoteAddr='request.remoteAddr,' - - -\
    [Date=',currentDate:d/MMM/yyyy:H:mm:ss,'] '

This produces output that looks like the following:

RemoteAddr=remoteAddr1 - - -[Date=12Jul1999:22:04:47]
RemoteAddr=remoteAddr2 - - -[Date=13Jul1999:02:16:31]

From the example, you can see that strings enclosed in single quotes are written to the log file as-is. This lets you craft almost any kind of flat file format you like without writing a single line of Java.


By default, a formatting logger terminates lines in the log file with newlines. This behavior is configurable with the lineTerminator property:


loading table of contents...