Class UniformLogFormatter

  • All Implemented Interfaces:
    LogEventBroadcaster

    public class UniformLogFormatter
    extends AnsiColorFormatter
    implements LogEventBroadcaster
    UniformLogFormatter conforms to the logging format defined by the Log Working Group in Java Webservices Org. The specified format is "[#|DATETIME|LOG_LEVEL|PRODUCT_ID|LOGGER NAME|OPTIONAL KEY VALUE PAIRS| MESSAGE|#]\n"
    Author:
    Hemanth Puttaswamy

    TODO: 1. Performance improvement. We can Cache the LOG_LEVEL|PRODUCT_ID strings and minimize the concatenations and revisit for more performance improvements 2. Need to use Product Name and Version based on the version string that is part of the product. 3. Stress testing 4. If there is a Map as the last element, need to scan the message to distinguish key values with the message argument.

    • Constructor Detail

      • UniformLogFormatter

        public UniformLogFormatter()
      • UniformLogFormatter

        public UniformLogFormatter​(String excludeFields)
    • Method Detail

      • format

        public String format​(LogRecord record)
        _REVISIT_: Replace the String Array with an HashMap and do some benchmark to determine whether StringCat is faster or Hashlookup for the template is faster.
        Specified by:
        format in class Formatter
      • getNameValuePairs

        protected void getNameValuePairs​(StringBuilder buf,
                                         LogRecord record)
        Sun One Appserver SE/EE? can override to specify their product specific key value pairs.
      • getRecordBeginMarker

        public String getRecordBeginMarker()
      • setRecordBeginMarker

        public void setRecordBeginMarker​(String recordBeginMarker)
      • getRecordEndMarker

        public String getRecordEndMarker()
      • setRecordEndMarker

        public void setRecordEndMarker​(String recordEndMarker)
      • getRecordFieldSeparator

        public String getRecordFieldSeparator()
      • setRecordFieldSeparator

        public void setRecordFieldSeparator​(String recordFieldSeparator)
      • getRecordDateFormat

        public String getRecordDateFormat()
      • setRecordDateFormat

        public void setRecordDateFormat​(String recordDateFormat)