Package com.yahoo.log

Class VespaFormatter


  • public class VespaFormatter
    extends java.util.logging.SimpleFormatter
    This class implements a log formatter which takes care of formatting messages according to the VESPA common log format.
    Author:
    Bjorn Borud, arnej27959
    • Constructor Summary

      Constructors 
      Constructor Description
      VespaFormatter()
      Default constructor
      VespaFormatter​(java.lang.String serviceName, java.lang.String componentPrefix)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String format​(java.util.logging.LogRecord r)  
      java.lang.String getServiceName()
      Get the service name for this formatter.
      void setServiceName​(java.lang.String serviceName)
      Set the service name (usually the VESPA config-id) of this formatter.
      static java.lang.String toMessageString​(java.lang.Throwable t)  
      static java.lang.String unEscape​(java.lang.String s)
      Un-escapes previously escaped string.
      • Methods inherited from class java.util.logging.Formatter

        formatMessage, getHead, getTail
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • serviceNameUnsetValue

        public static final java.lang.String serviceNameUnsetValue
        See Also:
        Constant Field Values
    • Constructor Detail

      • VespaFormatter

        public VespaFormatter()
        Default constructor
      • VespaFormatter

        public VespaFormatter​(java.lang.String serviceName,
                              java.lang.String componentPrefix)
        Parameters:
        serviceName - The VESPA service name.
        componentPrefix - The application name.
    • Method Detail

      • unEscape

        public static java.lang.String unEscape​(java.lang.String s)
        Un-escapes previously escaped string. note: look at com.yahoo.config.StringNode.unescapeQuotedString()
        Parameters:
        s - String that might need un-escaping
        Returns:
        Returns un-escaped string
      • format

        public java.lang.String format​(java.util.logging.LogRecord r)
        Overrides:
        format in class java.util.logging.SimpleFormatter
      • setServiceName

        public void setServiceName​(java.lang.String serviceName)
        Set the service name (usually the VESPA config-id) of this formatter.
        Parameters:
        serviceName - The service name
      • getServiceName

        public java.lang.String getServiceName()
        Get the service name for this formatter.
        Returns:
        Returns the service name.
      • toMessageString

        public static java.lang.String toMessageString​(java.lang.Throwable t)