Summary: Formatting the logged output
OverviewThe logged output of a logger can be customized to any format, such as an XML or a human readable format. Typically each logging Handler will have a Formatter associated with it. The Formatter takes a LogRecord and converts it to a string. The default Formatter assigned to the Handlers declared in the logging configuration file is com.gigaspaces.logger.GSSimpleFormatter. This formatter is based on the java.util.logging.SimpleFormatter class, which prints a brief summary of the LogRecord in a human readable format. The format PropertyThe LogRecord passed to the Formatter is converted to a string, as specified by the format property in the logging configuration file. PlaceholdersThe format is simply a string, which can contain any character including line-break characters. GigaSpaces provides several placeholders that can be added to the message. 0 - Date object The default formatBy default, the logging configuration file comes with the following as the default format: com.gigaspaces.logger.GSSimpleFormatter.format = {0,date,yyyy-MM-dd HH:mm:ss,SSS} {6} {3} [{4}] - {5} Which translates to: Date and time printed down to the millisecond, context (if available), the log level of the message, the logger name and the message. Customized formatIf you wish to customize the format, change the default setting the in the logging configuration file (<GigaSpaces>/config/gs_logging.properties). com.gigaspaces.logger.GSSimpleFormatter.format={0,date} {1}.{2}(..) {3} - {5} Which translates to: Date in it's simplest form, Class name and method, the log level of the message and the message Jul 14, 2009 com.gigaspaces.Class.method(..) INFO - Sample message
For more details on how to customize a message see java.text.MessageFormat and java.text.SimpleDateFormat |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |