Module eclipselink

Class JavaLog

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

public class JavaLog extends AbstractSessionLog
Provides java.util.logging specific logging functions.
See Also:
  • Field Details

  • Constructor Details

    • JavaLog

      public JavaLog()
      Creates a new instance of wrapper class for java.util.logging.
  • Method Details

    • addLogger

      protected void addLogger(String loggerCategory, String loggerNameSpace)
      INTERNAL: Add Logger to the categoryloggers.
    • getCategoryLoggers

      public Map<String,Logger> getCategoryLoggers()
      INTERNAL: Return catagoryloggers
    • getLevel

      public int getLevel(String category)
      Return the effective log level for the name space extracted from session and category. If a Logger's level is set to be null then the Logger will use an effective Level that will be obtained by walking up the parent tree and using the first non-null Level.
      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 effective log level.
    • setLevel

      public void setLevel(int level, String category)
      Set the log level to a logger with name space extracted from the given category.
      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" ...
    • setWriter

      public void setWriter(OutputStream fileOutputStream)
      Set the output stream that will receive the formatted log entries.
      Overrides:
      setWriter in class AbstractSessionLog
      Parameters:
      fileOutputStream - the file output stream will receive the formatted log entries.
    • getNameSpaceString

      protected String getNameSpaceString(String category)
      INTERNAL: Return the name space for the given category from the map.
    • getLogger

      protected Logger getLogger(String category)
      INTERNAL: Return the Logger for the given category
    • getJavaLevel

      protected Level getJavaLevel(int level)
      INTERNAL: Return the corresponding java.util.logging.Level for a given TopLink 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
    • log

      public void log(SessionLogEntry entry)
      Log a SessionLogEntry
      Parameters:
      entry - SessionLogEntry that holds all the information for a TopLink logging event
    • internalLog

      protected void internalLog(SessionLogEntry entry, Level javaLevel, Logger logger)
      INTERNAL:

      Build a LogRecord

      Parameters:
      entry - SessionLogEntry that holds all the information for a TopLink logging event
      javaLevel - the message level
    • throwing

      public void throwing(Throwable throwable)
      Log a throwable.
      Specified by:
      throwing in interface SessionLog
      Overrides:
      throwing in class AbstractSessionLog
      Parameters:
      throwable - a throwable
    • clone

      public Object clone()
      INTERNAL: Each session owns its own session log because session is stored in the session log
      Specified by:
      clone in interface SessionLog
      Overrides:
      clone in class AbstractSessionLog
      Returns:
      the cloned log