Package com.yahoo.log
Class LogMessage
java.lang.Object
com.yahoo.log.LogMessage
This class implements the common ground log message used by
the logserver. A LogMessage is immutable. Note that we have
chosen the name LogMessage to avoid confusion with LogRecord
which is used in java.util.logging.
- Author:
- Bjorn Borud, bjorncs
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getEvent()
If the LogMessage was an EVENT then this method can be used to get the Event instance representing the event.getHost()
getLevel()
long
int
hashCode()
static LogMessage
of
(Instant time, String host, long processId, long threadId, String service, String component, Level level, String payload) static LogMessage
parseNativeFormat
(String msg) Make a log message from the native format of the logging package.toString()
Return valid representation of log message.
-
Method Details
-
of
-
getTimestamp
-
getHost
-
getProcessId
public long getProcessId() -
getThreadId
-
getService
-
getComponent
-
getLevel
-
getPayload
-
parseNativeFormat
Make a log message from the native format of the logging package.- Parameters:
msg
- The log message- Returns:
- Returns a LogMessage instance
- Throws:
InvalidLogFormatException
- if the log message can not be parsed, ie. is invalid, we throw this exception.
-
getEvent
If the LogMessage was an EVENT then this method can be used to get the Event instance representing the event. The event instance created the first time this method is called and then cached. TODO: make sure this throws exception!- Returns:
- Returns Event instance if this is an event message
and the payload is correctly formatted. Otherwise
it will return
null
. - Throws:
MalformedEventException
-
toString
Return valid representation of log message. -
equals
-
hashCode
public int hashCode()
-