Class ExtensionsLog

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

public class ExtensionsLog extends Object
Instances hold the log entries for a single extension.
Since:
3.19.8
Author:
nicklas
  • Field Details

    • logs

      private static Map<String,ExtensionsLog> logs
    • extensionId

      private final String extensionId
    • logEntries

      private final Deque<LogEntry> logEntries
    • lock

      private final ReadWriteLock lock
    • maxEntries

      private int maxEntries
    • numEntries

      private volatile int numEntries
    • numWarnings

      private volatile int numWarnings
    • numErrors

      private volatile int numErrors
    • isDebugEnabled

      private boolean isDebugEnabled
    • copyToStdout

      private boolean copyToStdout
  • Constructor Details

    • ExtensionsLog

      private ExtensionsLog(String extensionId)
  • Method Details

    • getLog

      public static ExtensionsLog getLog(String extensionId, boolean create)
      Get the service log for the given extension. If the log doens't exists yet it can optionally be created.
    • getLogger

      public static ExtensionsLogger getLogger(String extensionId, boolean create)
      Get a logger that can add entries to the log for the given extension. If the log doesn't exists yet, it can optionally be created.
    • createLogger

      public static ExtensionsLogger createLogger(String extensionId)
      Create a logger that can add entries to the log for the given extension. If the log doesn't exists yet, it is be created.
    • getExtensionId

      public String getExtensionId()
      Get the extension id of the log.
    • isDebugEnabled

      public boolean isDebugEnabled()
      Is the debug-level enabled?
    • setDebugEnabled

      public void setDebugEnabled(boolean debugEnabled)
      Enable or disable debug-level logging.
    • isCopyingToStdout

      public boolean isCopyingToStdout()
      Are log entries copied to standard output?
    • setCopyToStdout

      public void setCopyToStdout(boolean copyToStdout)
      Enable or disable copies of log entries to standard output. When enabled, TRACE-level log entries are also written if debugging is enabled.
    • getMaxEntries

      public int getMaxEntries()
      Get the max number of entries to keep in the log.
    • getNumEntries

      public int getNumEntries()
      Get the current number of entries in the log.
    • getNumWarnings

      public int getNumWarnings()
      Get the current number of warning entries in the log.
    • getNumErrors

      public int getNumErrors()
      Get the current number of error entries in the log.
    • clearLog

      public void clearLog()
      Clear the log.
    • createLogger

      public ExtensionsLogger createLogger()
      Create a logger that adds messages to this log.
    • add

      void add(LogEntry entry)
      Add a log entry. DEBUG level messages are skipped unless debug-level is enabled. TRACE level messages are always skipped but can be written to standard output if that option and debugging is enabled.
    • getLogEntries

      public Iterator<LogEntry> getLogEntries()
      Get an iterator that is returning all entries in the log. The returned iterator is read-only and the Iterator.remove() method will throw an exception.