Class SessionLogEntry

java.lang.Object
org.eclipse.persistence.logging.SessionLogEntry
All Implemented Interfaces:
Serializable

public class SessionLogEntry extends Object implements Serializable
SessionLogEntry is a simple container object that holds all the information pertinent to an EclipseLink logging event. It has a time stamp indicating when the event took place. It holds the session, thread, and accessor responsible for the event. And it holds whatever message was passed through to be logged.
Since:
TOPLink/Java 3.0
See Also:
  • Field Details

  • Constructor Details

    • SessionLogEntry

      @Deprecated(forRemoval=true, since="4.0.9") public SessionLogEntry(int level, String category, String sessionId, String message, Object[] params, Integer connectionId, boolean shouldTranslate)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Translation will not be part of the logger, shouldTranslate will be removed
      Create a new session log entry for the specified log level, category, session, message, parameters, and datasource connection identifier.

      The log entry is created with the current thread and timestamp. The exception associated with the log entry is set to null.

      Parameters:
      level - the log level of the entry
      category - the category of the log entry
      sessionId - the identifier of the session that generated the log entry
      message - the log message
      params - an array of parameters associated with the log message
      connectionId - the identifier of the datasource connection that generated the log entry
      shouldTranslate - whether the log message should be translated
      See Also:
    • SessionLogEntry

      public SessionLogEntry(int level, String category, String sessionId, String message, Throwable throwable)
      Creates a new session log entry for the specified log level, category, session, message, and throwable.

      The log entry is created with the current thread and timestamp. The category is set to the provided category, and the parameters are set to an empty array. The log message is set to the provided message.

      The log message is not translated by default.

      Parameters:
      level - the log level of the entry
      category - the category of the log entry
      sessionId - the identifier of the session that generated the log entry
      message - the log message
      throwable - the exception that caused the log entry
      See Also:
  • Method Details

    • getConnectionId

      public Integer getConnectionId()
      Return the datasource connection identifier that generated the log entry.
      Returns:
      the datasource connection identifier
    • getTimeStamp

      public Instant getTimeStamp()
    • getException

      public Throwable getException()
      Return the exception that caused the log entry.
      Returns:
      the exception
    • getMessage

      public String getMessage()
      Return the log entry's message.
      Returns:
      the message
    • getSessionId

      public String getSessionId()
      Return the session identifier that generated the log entry.
      Returns:
      the session identifier
    • getThread

      public Thread getThread()
      Return the thread that was active when the log entry was generated.
      Returns:
      the thread
    • getLevel

      public int getLevel()
      Return the request level of the log entry.
      Possible values for log level are listed in SessionLog.
      Returns:
      the request level of the log entry
      See Also:
    • getNameSpace

      public String getNameSpace()
      Return the name space of the log entry.
      Possible values for log category (a String) are listed in SessionLog.
      Returns:
      the name space of the log entry
      See Also:
    • getParameters

      public Object[] getParameters()
      Returns:
      the array of parameters to the message.
    • getSourceClassName

      public String getSourceClassName()
      Returns:
      the source class name to the message
    • getSourceMethodName

      public String getSourceMethodName()
      Returns:
      the source method name to the message
    • shouldTranslate

      @Deprecated(forRemoval=true, since="4.0.9") public boolean shouldTranslate()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will be removed from the class, translation will not be part of the logger
      Returns:
      if the message should be translated.
    • hasException

      public boolean hasException()
      Returns:
      if the log entry was for an exception.
    • hasMessage

      public boolean hasMessage()
      Returns:
      if the log entry has a message
    • setTimeStamp

      public void setTimeStamp(Instant timeStamp)
    • setException

      public void setException(Throwable throwable)
      Set the exception that caused the log entry.
      Parameters:
      throwable - the exception
    • setMessage

      public void setMessage(String message)
      Set the entry's message.
      Parameters:
      message - the message
    • setSessionId

      public void setSessionId(String sessionId)
      Set the session identifier that generated the log entry.
      Parameters:
      sessionId - the session identifier
    • setThread

      public void setThread(Thread thread)
      Set the thread that was active when the log entry was generated.
      Parameters:
      thread - the thread
    • setLevel

      public void setLevel(int level)
      Set the request level of the log entry.
      Possible values for log level are listed in SessionLog.
      Parameters:
      level - the log level
      See Also:
    • setNameSpace

      public void setNameSpace(String nameSpace)
      Set the name space of the log entry.
      Possible values for log category (a String) are listed in SessionLog.
      Parameters:
      nameSpace - the log category
      See Also:
    • setParameters

      public void setParameters(Object[] params)
      Set the array of parameters to the message.
      Parameters:
      params - array of parameters
    • setShouldTranslate

      @Deprecated(forRemoval=true, since="4.0.9") public void setShouldTranslate(boolean shouldTranslate)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will be removed from the class, translation will not be part of the logger
      Set if the message should be translated.
      Parameters:
      shouldTranslate - true if the message should be translated, false otherwise
    • setSourceClassName

      public void setSourceClassName(String sourceClassName)
      Set the source class name to the message.
      Parameters:
      sourceClassName - source class name
    • setSourceMethodName

      public void setSourceMethodName(String sourceMethodName)
      Set the source method name to the message.
      Parameters:
      sourceMethodName - source method name
    • toString

      public String toString()
      Overrides:
      toString in class Object