Class ExtensionsLogger

java.lang.Object
net.sf.basedb.util.extensions.logging.ExtensionsLogger

public class ExtensionsLogger extends Object
A simple logger that services can use to send log message to the BASE core. An instance is handed out to the service by the ServiceControllerAction.start() method, which the service can use as long as it is running.

Note that the BASE core will automatically send INFO-level messages when the service is started and stopped.

The log is kept in memory only and will not survive server restarts. The number of log entries is also limited. When the limit is reached the oldest entries are automatically removed from the log.

Since:
3.19.8
Author:
nicklas
  • Field Details

  • Constructor Details

  • Method Details

    • wrap

      public ExtensionsLogger wrap(Logger otherLogger)
      Wrap a generic SLF4J logger with this logger. Messages that are submitted to the logger created by this method are also forwarded to the SLF4J logger.
    • isDebugEnabled

      public boolean isDebugEnabled()
      Check if DEBUG logging has been enabled or not. Debug logging can be enabled either by the ExtensionsLog.setDebugEnabled(boolean) method or by a wrapped Logger.
    • isTraceEnabled

      public boolean isTraceEnabled()
      Check if TRACE logging has been enabled or not. Trace logging is enabled only if both DEBUG logging and ExtensionsLog.isCopyingToStdout() are enabled or if a wrapped Logger has it enabled.
    • log

      public void log(LogLevel level, String msg)
      Log a message at the specified level.
    • log

      public void log(LogLevel level, String msg, Throwable stacktrace)
      Log a message at the specified level with an optional stacktrace.
    • info

      public void info(String msg)
      Log an INFO message.
    • info

      public void info(String msg, Throwable stacktrace)
      Log an INFO message with an optional stacktrace.
    • warn

      public void warn(String msg)
      Log a WARNING message.
    • warn

      public void warn(String msg, Throwable t)
      Log a WARNING message with an optional stacktrace.
    • error

      public void error(String msg)
      Log an ERROR message.
    • error

      public void error(String msg, Throwable t)
      Log an ERROR message with an optional stacktrace.
    • debug

      public void debug(String msg)
      Log a DEBUG message.
    • debug

      public void debug(String msg, Throwable t)
      Log a DEBUG message with an optional stacktrace.
    • trace

      public void trace(String msg)
      Log a TRACE message with the related SLF4J logger. If no SLF4J logger is related (see wrap(org.slf4j.Logger)) all TRACE messages will be ignored.
    • trace

      public void trace(String msg, Throwable t)
      Log a TRACE message with an optional stacktrace. If no SLF4J logger is related (see wrap(org.slf4j.Logger)) all TRACE messages will be ignored.