Package com.yahoo.log
Class VespaFormatter
- java.lang.Object
-
- java.util.logging.Formatter
-
- java.util.logging.SimpleFormatter
-
- com.yahoo.log.VespaFormatter
-
public class VespaFormatter extends SimpleFormatter
This class implements a log formatter which takes care of formatting messages according to the VESPA common log format.- Author:
- Bjorn Borud, arnej27959
-
-
Field Summary
Fields Modifier and Type Field Description static String
serviceNameUnsetValue
-
Constructor Summary
Constructors Constructor Description VespaFormatter()
Default constructorVespaFormatter(String serviceName, String componentPrefix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(LogRecord r)
String
getServiceName()
Get the service name for this formatter.void
setServiceName(String serviceName)
Set the service name (usually the VESPA config-id) of this formatter.static String
toMessageString(Throwable t)
static String
unEscape(String s)
Un-escapes previously escaped string.-
Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
-
-
-
-
Field Detail
-
serviceNameUnsetValue
public static final String serviceNameUnsetValue
- See Also:
- Constant Field Values
-
-
Method Detail
-
unEscape
public static String unEscape(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 String format(LogRecord r)
- Overrides:
format
in classSimpleFormatter
-
setServiceName
public void setServiceName(String serviceName)
Set the service name (usually the VESPA config-id) of this formatter.- Parameters:
serviceName
- The service name
-
getServiceName
public String getServiceName()
Get the service name for this formatter.- Returns:
- Returns the service name.
-
-