de.infinityloop.util.log
Class LogEvent

java.lang.Object
  extended by de.infinityloop.util.log.LogEvent

public class LogEvent
extends java.lang.Object

Holds the full information of a log message.

Since:
5.2.5
Author:
chris

Field Summary
static int ALL
           
static int DEBUG
           
static int DETAIL
           
static int ERROR
           
static int FATAL
           
static int INFO
           
static int INHERIT
           
static java.lang.String kMDCApplicationKey
           
static java.lang.String kMDCComponentKey
           
static java.lang.String kMDCModuleKey
           
static java.lang.String kMDCPipelineKey
           
static java.lang.String kMDCRootKey
           
static int OFF
           
static int TRACE
           
static int UNSET
           
static int VERBOSE
           
static int WARN
           
static int WARNING
           
 
Constructor Summary
LogEvent(int level, int messagecode, java.lang.String message)
           
LogEvent(int msg, java.lang.Object par1)
           
LogEvent(int msg, java.lang.Object[] prm)
           
LogEvent(int msg, java.lang.Object[] prm, java.lang.Throwable t)
          Constructor for an element of a NotificationCollector entry list.
LogEvent(int msg, java.lang.Object par1, java.lang.Object par2)
           
LogEvent(int level, java.lang.String message)
           
LogEvent(int msg, java.lang.String msgTemplate, java.lang.Object[] prm, java.lang.Throwable t)
           
 
Method Summary
 java.lang.Throwable getAssociatedException()
          Retrieves any embedded exception.
 java.lang.String getFullMessage()
          Formats the final message, including context and timestamp info.
static int getLevelId(java.lang.String l)
          Translate a human readable string representation into a numeric message level
static java.lang.String getLevelName(int l)
          Translate numeric level into a human readable string representation
 java.lang.String getMessage()
          Formats the final message.
 int getMessageCode()
          Retrieves the error code.
 int getMessageLevel()
          Calculate the message type from its code
 java.lang.Object[] getMessageParameters()
          retrieves the parameter objects for this entry which were used to format the message
 java.lang.String getMessageTemplate()
          retrieves the message template as String from the common Msg resource
 java.lang.String getMessageTimestamp()
          Format this LogEvent's time stamp into something usable for diaply in a log file.
static void popAndRestoreMDC(java.lang.String key, java.lang.String savedMessage)
          Restore a saved message to the MDC.
static java.lang.String saveAndPushMDC(java.lang.String key, java.lang.String message)
          Remember the old value and push a new one to the MDC.
static void setMessageBundle(java.lang.String bundleName)
           
 java.lang.String toString()
          Same as getMessage()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kMDCRootKey

public static final java.lang.String kMDCRootKey
See Also:
Constant Field Values

kMDCApplicationKey

public static final java.lang.String kMDCApplicationKey
See Also:
Constant Field Values

kMDCPipelineKey

public static final java.lang.String kMDCPipelineKey
See Also:
Constant Field Values

kMDCModuleKey

public static final java.lang.String kMDCModuleKey
See Also:
Constant Field Values

kMDCComponentKey

public static final java.lang.String kMDCComponentKey
See Also:
Constant Field Values

UNSET

public static final int UNSET
See Also:
Constant Field Values

INHERIT

public static final int INHERIT
See Also:
Constant Field Values

OFF

public static final int OFF
See Also:
Constant Field Values

FATAL

public static final int FATAL
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

WARN

public static final int WARN
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

VERBOSE

public static final int VERBOSE
See Also:
Constant Field Values

DETAIL

public static final int DETAIL
See Also:
Constant Field Values

TRACE

public static final int TRACE
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values
Constructor Detail

LogEvent

public LogEvent(int msg,
                java.lang.Object[] prm,
                java.lang.Throwable t)
Constructor for an element of a NotificationCollector entry list.

Parameters:
msg - the message code
prm - the parameters to be used for formatting the message
t - any Exception associated with the log object
See Also:
LogEventCollector

LogEvent

public LogEvent(int msg,
                java.lang.Object par1)

LogEvent

public LogEvent(int msg,
                java.lang.Object par1,
                java.lang.Object par2)

LogEvent

public LogEvent(int msg,
                java.lang.Object[] prm)

LogEvent

public LogEvent(int msg,
                java.lang.String msgTemplate,
                java.lang.Object[] prm,
                java.lang.Throwable t)

LogEvent

public LogEvent(int level,
                java.lang.String message)

LogEvent

public LogEvent(int level,
                int messagecode,
                java.lang.String message)
Method Detail

getAssociatedException

public java.lang.Throwable getAssociatedException()
Retrieves any embedded exception. Returns null when there is none.

Returns:
the Throwable object or null

getMessageCode

public int getMessageCode()
Retrieves the error code.

Returns:
the error code
See Also:
LogEventCollector, Msg

getMessageTemplate

public java.lang.String getMessageTemplate()
retrieves the message template as String from the common Msg resource

Returns:
the message as human readable String
See Also:
Msg

getMessage

public java.lang.String getMessage()
Formats the final message.

Returns:
the message as human readable String
See Also:
Msg

getFullMessage

public java.lang.String getFullMessage()
Formats the final message, including context and timestamp info.

Returns:
the message as human readable String
See Also:
Msg

getMessageParameters

public java.lang.Object[] getMessageParameters()
retrieves the parameter objects for this entry which were used to format the message

Returns:
the parameter Object[] array or null if not available
See Also:
Msg

toString

public java.lang.String toString()
Same as getMessage()

Overrides:
toString in class java.lang.Object

getMessageLevel

public int getMessageLevel()
Calculate the message type from its code

Parameters:
code -
Returns:

setMessageBundle

public static void setMessageBundle(java.lang.String bundleName)

getLevelName

public static java.lang.String getLevelName(int l)
Translate numeric level into a human readable string representation

Parameters:
l - the level
Returns:
the human readable String, e.g. "ERROR" or "DEBUG".

getLevelId

public static int getLevelId(java.lang.String l)
Translate a human readable string representation into a numeric message level

Parameters:
l - the level
Returns:
one of the defined level constants or -1 when not defined

getMessageTimestamp

public java.lang.String getMessageTimestamp()
Format this LogEvent's time stamp into something usable for diaply in a log file.

Returns:
a string representation of the time stamp in the format "dd MMM yy HH:mm:ss.SSS".

saveAndPushMDC

public static java.lang.String saveAndPushMDC(java.lang.String key,
                                              java.lang.String message)
Remember the old value and push a new one to the MDC.

Parameters:
key -
message -
Returns:

popAndRestoreMDC

public static void popAndRestoreMDC(java.lang.String key,
                                    java.lang.String savedMessage)
Restore a saved message to the MDC.

Parameters:
key -
savedMessage -