SummaryItems are JavaBeans with properties; thus, they can be logged. When logging a SummaryItem, it is useful to log properties of both the SummaryItem and the data item being summarized. For this reason, the data collection package contains summary loggers that extend the logging syntax to support this.
The Formatting File Logger has a corresponding formatting summary logger and the SQL table logger has a corresponding SQL table summary logger. The summary loggers are just like the regular loggers, except that they add the ability to refer to summary variables as well as data item properties. See the Formatting File Loggers and Database Loggers sections in this chapter, and the Summary Variables topic in this section.
Continuing the example, you might have a summarizer listening for AdEvents with the following groupBy:
groupBy=accountName,campaignName,adName
To log the summarizer’s SummaryItems to a log file, configure a summary logger as a dataListener of the summarizer, with properties as follows:
$class=atg.service.datacollection.FormattingSummaryFileLogger logFileDir=logs logFileName=foo.txt # the things that will be logged formatFields=accountName,campaignName,AdName,%SummaryCount fieldDelimiter=:
The only thing new here is %SummaryCount value in the formatFields property. This refers to the SummaryCount summary variable, while the other properties refer to properties of the data item being summarized. In the example, the logger writes the accountName, campaignName, adName, and the count of how many AdEvents were received. The summarizer might receive the following events during a single flush interval:
accountName | campaignName | adName |
|---|---|---|
OmniCorp | new image |
|
OmniCorp | new image |
|
OmniCorp | new image |
|
OmniCorp | new image |
|
OmniCorp | new image |
|
MegaSomething | traditional |
|
MegaSomething | new image |
|
The summarizer generates SummaryItems, sends them to the summary logger, which in turn writes the following to the log file:
OmniCorp:new image:small_banner:3 OmniCorp:new image:large_banner:2 MegaSomething:traditional:small_banner:1 MegaSomething:new image:small_banner:1

