ATG Customizing Log Formats

Since you know all component in ATG defaultly send their log events to a single logQueue component,we might need to customize log formats which best suits for our own components.

For formatting log messages for your own components,there were two OOTB classes provided by ATG
atg.service.datacollection.FormattingFileLogger  and atg.service.datacollection.FormattingConsoleLogger

you can create your own logger components  
by creating the component(properties) for the class FormattingFileLogger/FormattingConsoleLogger.

# directory and file name
formatFields= '<',dateTimeStamp:d/MMM/yyyy:H:mm:ss,'>',' [',sessionID,'] ',browserID,'"',comma,'IP="',ipAddress,'"'

similar way you can create the Console Logger by removing the properties logFileDir,logFileName etc, as this is logged to the i am not providing any example.

To Format  your own component ,specify these two components in the logListeners property.

# /xxx/xxx/xxx/postLogin
# rotate file every day at 12:00AM
schedule= * * . * 0 0

You are done !!!,now use the log statement inside your class,For Eg: logDebug(),you will see the logs generated in the format you wish or mentioned as per the formatFields property.

See also Logging Tips


Post a Comment

Related Posts Plugin for WordPress, Blogger...