Module eclipselink

Class 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 date/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.
    See Also:
    SessionLog, DefaultSessionLog, Serialized Form
    Author:
    Big Country
    Since:
    TOPLink/Java 3.0
    • Field Detail

      • date

        @Deprecated(forRemoval=true)
        protected Date date
        Deprecated, for removal: This API element is subject to removal in a future version.
      • session

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected transient Session session
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use getSessionId() instead
        The session that generated the log entry.
      • thread

        protected transient Thread thread
      • connection

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected transient org.eclipse.persistence.internal.databaseaccess.Accessor connection
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use getConnectionId() instead
        The connection that generated the log entry.
      • message

        protected String message
      • level

        protected int level
      • nameSpace

        protected String nameSpace
      • parameters

        protected Object[] parameters
      • shouldTranslate

        protected boolean shouldTranslate
      • sourceClassName

        protected String sourceClassName
      • sourceMethodName

        protected String sourceMethodName
    • Constructor Detail

      • SessionLogEntry

        public SessionLogEntry​(int level,
                               String category,
                               String sessionId,
                               String message,
                               Object[] params,
                               Integer connectionId,
                               boolean shouldTranslate)
        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:
        SessionLog
      • 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:
        SessionLog
      • SessionLogEntry

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public SessionLogEntry​(Session session,
                               String message,
                               org.eclipse.persistence.internal.databaseaccess.Accessor connection)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use SessionLogEntry(int, String, String, String, Object[], Integer, boolean) with the following parameters:
        • level set to SessionLog.INFO
        • category set to null
        • sessionId set to Session.getSessionId() or null when session is null
        • params set to null
        • connectionId set to Accessor.getConnectionId() or null when connection is null
        • shouldTranslate set to false
        Create a new session log entry for the specified session, message, and accessor.
        Parameters:
        session - the session that generated the log entry
        message - the log message
        connection - the accessor that generated the log entry
        See Also:
        SessionLog
      • SessionLogEntry

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public SessionLogEntry​(int level,
                               Session session,
                               String message,
                               Object[] params,
                               org.eclipse.persistence.internal.databaseaccess.Accessor connection,
                               boolean shouldTranslate)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use SessionLogEntry(int, String, String, String, Object[], Integer, boolean) with the following parameters:
        Create a new session log entry for the specified log level, session, message, parameters, and datasource connection.
        Parameters:
        level - the log level of the entry
        session - the session that generated the log entry
        message - the log message
        params - an array of parameters associated with the log message
        connection - the datasource connection that generated the log entry
        shouldTranslate - whether the log message should be translated
        See Also:
        SessionLog
      • SessionLogEntry

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public SessionLogEntry​(int level,
                               String category,
                               Session session,
                               String message,
                               Object[] params,
                               org.eclipse.persistence.internal.databaseaccess.Accessor connection,
                               boolean shouldTranslate)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use SessionLogEntry(int, String, String, String, Object[], Integer, boolean) with the following parameters:
        Create a new session log entry for the specified log level, category, session, message, parameters, and datasource connection.
        Parameters:
        level - the log level
        category - the category
        session - the session
        message - the message
        params - array of parameters
        connection - the accessor
        shouldTranslate - true if the entry should be translated
        See Also:
        SessionLog
      • SessionLogEntry

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public SessionLogEntry​(Session session,
                               int level,
                               String category,
                               Throwable throwable)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use SessionLogEntry(int, String, String, String, Throwable) with the following parameters:
        • message set to ""
        Creates a new session log entry for the specified session, log level, category, and exception.
        Parameters:
        session - the session that generated the log entry
        level - the log level of the entry
        category - the category of the log entry
        throwable - the exception associated with the log entry
        See Also:
        SessionLog
    • Method Detail

      • getConnection

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public org.eclipse.persistence.internal.databaseaccess.Accessor getConnection()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use getConnectionId() instead
        Return the connection that generated the log entry.
        Returns:
        the connection accessor
      • getConnectionId

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

        @Deprecated(forRemoval=true)
        public Date getDate()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Return the date of the log entry.
        Returns:
        the date
      • 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
      • getSession

        public Session getSession()
        Deprecated.
        Use getSessionId() instead
        Return the session that generated the log entry.
        Returns:
        the session
      • 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:
        SessionLog
      • 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:
        SessionLog
      • 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

        public boolean shouldTranslate()
        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
      • setConnection

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void setConnection​(org.eclipse.persistence.internal.databaseaccess.Accessor connection)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Accessor instance will be removed and replaced with readonly connectionId
        Set the connection that generated the log entry.
        Parameters:
        connection - the connection
      • setDate

        @Deprecated(forRemoval=true)
        public void setDate​(Date date)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the date of the log entry.
        Parameters:
        date - the date
      • 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
      • setSession

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void setSession​(Session session)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the session that generated the log entry.
        Parameters:
        session - the session
      • 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:
        SessionLog
      • 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:
        SessionLog
      • setParameters

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

        public void setShouldTranslate​(boolean shouldTranslate)
        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