Class DefaultSessionLog

java.lang.Object
org.eclipse.persistence.logging.AbstractSessionLog
org.eclipse.persistence.logging.DefaultSessionLog
All Implemented Interfaces:
Serializable, Cloneable, SessionLog

public class DefaultSessionLog extends AbstractSessionLog implements Serializable
Purpose: Default log used for the session when message logging is enabled. The session can log information such as,
  • all SQL executed
  • informational messages
  • debugging information
  • all exceptions that occur within TopLink
As well information about the message can be logged such as,
  • the session logging the message
  • the connection executing the SQL
  • the thread in which the log entry occurred
  • the exact time (to milliseconds) that the log entry occurred
  • the stack trace to the exception
See Also:
Author:
Big Country
  • Field Details

    • fileName

      protected String fileName
      The filename associated with this DefaultSessionLog, if it is being written out to a file
  • Constructor Details

    • DefaultSessionLog

      public DefaultSessionLog()
    • DefaultSessionLog

      public DefaultSessionLog(Writer writer)
  • Method Details

    • setLevel

      public void setLevel(int level, String category)
      Description copied from class: AbstractSessionLog
      PUBLIC:

      Set the log level for the category name space.

      Specified by:
      setLevel in interface SessionLog
      Overrides:
      setLevel in class AbstractSessionLog
      Parameters:
      level - the new log level
      category - the string representation of an EclipseLink category, e.g. "sql", "transaction" ...
    • getLevel

      public int getLevel(String category)
      Description copied from class: AbstractSessionLog
      PUBLIC:

      Return the log level for the category name space.

      Specified by:
      getLevel in interface SessionLog
      Overrides:
      getLevel in class AbstractSessionLog
      Parameters:
      category - the string representation of a EclipseLink category, e.g. "sql", "transaction" ...
      Returns:
      the log level
    • shouldLog

      public boolean shouldLog(int level, String category)
      Check if a message of the given level would actually be logged by the logger with name space built from the given session and category.

      Specified by:
      shouldLog in interface SessionLog
      Overrides:
      shouldLog in class AbstractSessionLog
      Parameters:
      level - the log request level
      category - the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*
      Returns:
      true if the given message level will be logged for the given category
    • initialize

      protected void initialize()
      Initialize the log to be backward-compatible with the original TopLink log.
    • initialize

      protected void initialize(Writer writer)
      Initialize the log.
    • log

      public void log(SessionLogEntry entry)
      Log the entry. This writes the log entries information to a writer such as System.out or a file.
      Specified by:
      log in interface SessionLog
      Specified by:
      log in class AbstractSessionLog
      Parameters:
      entry - SessionLogEntry that holds all the information for an EclipseLink logging event
    • setWriter

      public void setWriter(String aFileName)
      Set the writer that will receive the formatted log entries for a file name.
    • getWriterFilename

      public String getWriterFilename()
      For the given writer, return it's associated filename. If associated writer does not have a filename, return null.
    • writeMessage

      protected void writeMessage(String message) throws IOException
      Append the specified message information to the writer.
      Throws:
      IOException
    • writeSeparator

      protected void writeSeparator() throws IOException
      Append the separator string to the writer.
      Throws:
      IOException