Class Logger_common_impl

java.lang.Object
org.apache.uima.util.impl.Logger_common_impl
All Implemented Interfaces:
Logger, org.slf4j.Logger
Direct Known Subclasses:
JSR47Logger_impl, Log4jLogger_impl, Logger_impl, Slf4jLogger_impl

public abstract class Logger_common_impl extends Object implements Logger
UIMA Logging interface common implementation Specific loggers extend this class

Logging "location" information:

  • This is the Classname / Methodname / and maybe line number where the logging statement is
  • is passed in on the logrb calls, but is not needed by modern loggers.
  • In V3, passed in value is ignored; loggers get what they need as configured.
  • In Java 9 this will be efficient

Limiting or throttling loggers: This is normally done using logger configuration. For cases where UIMA is running as an embedded library, sometimes Annotators log excessivly, and users do not have access to the logging configuration. But they do have access to APIs which create the UIMA pipelines.

V3 supports an additional param, AnalysisEngine.PARAM_THROTTLE_EXCESSIVE_ANNOTATOR_LOGGING which if set, specifies a limit of the number of log messages issued by Annotator code.

This requires:

  • marking loggers if they are Annotator loggers (e.g., their associated "class" used in setting the name of the logger, is assignable to AnalysisComponent_ImplBase, which includes: Annotators, CasMultipliers, and UimacppAnalysisComponents.
  • When setting up a logger in the UimaContext logger code (via setLogger), checking if the logger is an Annotator logger, and if so, setting the limit on it from the parameter associated with the UIMA context.

The loggers with a limit are cloned for the particular pipeline (represented by the root UIMA context), so that setting the limit only affects one pipeline.

The common part of logging does:

  • optional throttling
  • the UIMA specific resource bundle message conversions
  • the conversion of variants of log methods to standard ones
  • Field Details

    • EXCEPTION_MESSAGE

      protected static final String EXCEPTION_MESSAGE
      See Also:
    • EMPTY_STACK_TRACE_INFO

      protected static final String[] EMPTY_STACK_TRACE_INFO
    • fqcn

      protected final String fqcn
    • fqcnCmn

      protected final String fqcnCmn
    • limit_common

      protected final int limit_common
  • Constructor Details

    • Logger_common_impl

      protected Logger_common_impl(Class<?> component)
    • Logger_common_impl

      protected Logger_common_impl(Logger_common_impl lci, int limit)
      Copy constructor for limited loggers
      Parameters:
      lci - the original logger to copy
      limit - the limit
  • Method Details

    • log

      public abstract void log(org.slf4j.Marker m, String aFqcn, Level level, String message, Object[] args, Throwable throwable)
      The main log call implemented by subclasses
      Parameters:
      m - the marker
      aFqcn - the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method info
      level - the UIMA level
      message - -
      args - - arguments to be substituted into the message
      throwable - - can be null
    • log2

      public abstract void log2(org.slf4j.Marker m, String aFqcn, Level level, String message, Object[] args, Throwable throwable)
      The version of the main log call implemented by subclasses that uses {}, not {n} as the substitutable syntax. This syntax is used by log4j, slf4j, and others. But not used by uimaj logger basic syntax, or Java Util Logger. This version is called by all new logging statments that don't need to be backwards compatible. e.g. logger.info, logger.error, logger.warn, etc.
      Parameters:
      m - the marker
      aFqcn - the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method info
      level - the UIMA level
      message - -
      args - - arguments to be substituted into the message
      throwable - - can be null
    • log

      public abstract void log(org.slf4j.Marker m, String aFqcn, Level level, String message, Throwable throwable)
      The version of the main log call implemented by subclasses that skips the substitution because it already was done by rb()
      Parameters:
      m - the marker
      aFqcn - the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method info
      level - the UIMA level
      message - -
      throwable - - can be null
    • getMarkerForLevel

      public static org.slf4j.Marker getMarkerForLevel(Level level)
      Parameters:
      level - the Uima Level
      Returns:
      the Marker to use
    • log

      public void log(String aFqcn, Level level, String message, Throwable thrown)
      Convert a standard UIMA call for wrapped loggers
      Specified by:
      log in interface Logger
      Parameters:
      aFqcn - - fully qualified class name of highest level of logging impl. The class / method above this in the stack trace is used for identifying where the logging call originated from.
      level - the uima Level
      message - the message
      thrown - may be null
    • setOutputStream

      @Deprecated public void setOutputStream(OutputStream out)
      Deprecated.
      use external configuration possibility
      Description copied from interface: Logger
      Sets the output stream to which log messages will go. Setting the output stream to null will disable the logger.
      Specified by:
      setOutputStream in interface Logger
      Parameters:
      out - OutputStream to which log messages will be printed
      See Also:
    • setOutputStream

      @Deprecated public void setOutputStream(PrintStream out)
      Deprecated.
      use external configuration possibility
      Description copied from interface: Logger
      Sets the output stream to which log messages will go. Setting the output stream to null will disable the logger.
      Specified by:
      setOutputStream in interface Logger
      Parameters:
      out - PrintStream to which log messages will be printed
      See Also:
    • log

      @Deprecated public void log(String aMessage)
      Deprecated.
      use new function with log level
      Logs a message with level INFO.
      Specified by:
      log in interface Logger
      Parameters:
      aMessage - the message to be logged
    • log

      @Deprecated public void log(String aResourceBundleName, String aMessageKey, Object[] aArguments)
      Deprecated.
      use new function with log level
      Logs a message with a message key and the level INFO
      Specified by:
      log in interface Logger
      Parameters:
      aResourceBundleName - base name of resource bundle
      aMessageKey - key of message to localize with message level INFO
      aArguments - arguments to message (may be null if none)
      See Also:
    • logException

      @Deprecated public void logException(Exception aException)
      Deprecated.
      use new function with log level
      Logs an exception with level INFO
      Specified by:
      logException in interface Logger
      Parameters:
      aException - the exception to be logged
    • log

      public void log(Level level, String aMessage)
      Description copied from interface: Logger
      Logs a message.
      Specified by:
      log in interface Logger
      Parameters:
      level - message level
      aMessage - the message to be logged
    • log

      public void log(Level level, String aMessage, Object param1)
      Description copied from interface: Logger
      Logs a message with one parameter
      Specified by:
      log in interface Logger
      Parameters:
      level - message level
      aMessage - the message to be logged
      param1 - message parameter
    • log

      public void log(Level level, String aMessage, Object[] params)
      Description copied from interface: Logger
      Logs a message with an arbitrary number of parameters
      Specified by:
      log in interface Logger
      Parameters:
      level - message level
      aMessage - the message to be logged
      params - message parameter array
    • log

      public void log(Level level, String aMessage, Throwable thrown)
      Description copied from interface: Logger
      Logs a message and a throwable object
      Specified by:
      log in interface Logger
      Parameters:
      level - message level
      aMessage - the message to be logged
      thrown - throwable object
    • logrb

      public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Object param1)
      Description copied from interface: Logger
      Logs a message with a message key and one parameter. The real message is extracted from a resource bundle.
      Specified by:
      logrb in interface Logger
      Parameters:
      level - message level
      sourceClass - source class name
      sourceMethod - source method name
      bundleName - resource bundle
      msgKey - message key
      param1 - message parameter
    • logrb

      public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Object[] params)
      Description copied from interface: Logger
      Logs a message with a message key and an arbitrary number of parameters. The real message is extracted from a resource bundle.
      Specified by:
      logrb in interface Logger
      Parameters:
      level - message level
      sourceClass - source class name
      sourceMethod - source method name
      bundleName - resource bundle
      msgKey - message key
      params - message parameter array with an arbitrary number of parameters
    • logrb

      public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Throwable thrown)
      Description copied from interface: Logger
      Logs a message with a message key and a throwable object. The real message is extracted from a resource bundle.
      Specified by:
      logrb in interface Logger
      Parameters:
      level - message level
      sourceClass - source class name
      sourceMethod - source method name
      bundleName - resource bundle
      msgKey - message key
      thrown - throwable object
    • logrb

      public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey)
      Description copied from interface: Logger
      Logs a message with a message key. The real message is extracted from a resource bundle.
      Specified by:
      logrb in interface Logger
      Parameters:
      level - message level
      sourceClass - source class name
      sourceMethod - source method name
      bundleName - resource bundle
      msgKey - message key
    • setResourceManager

      @Deprecated public void setResourceManager(ResourceManager resourceManager)
      Deprecated.
      Description copied from interface: Logger
      Sets the ResourceManager to use for message localization. This method is intended for use by the framework, not by user code.
      Specified by:
      setResourceManager in interface Logger
      Parameters:
      resourceManager - A resource manager instance whose extension ClassLoader (if any) will be used for message localization by this logger.
    • rb

      public String rb(String bundleName, String msgKey, Object... parameters)
      Description copied from interface: Logger
      Get an internationalized message from a resource bundle by key name, substituting the parameters. This should be called via a Supplier to avoid computing this until needed
      Specified by:
      rb in interface Logger
      Parameters:
      bundleName - -
      msgKey - -
      parameters - -
      Returns:
      the internationalized message
    • isEmpty

      protected boolean isEmpty(String v)
    • isAnnotatorLogger

      public boolean isAnnotatorLogger()
      Description copied from interface: Logger
      This is true if the name of the logger corresponds to a class which implements AnalysisComponent_ImplBase, which includes basic Annotators, plus Cas Multipliers and CPP components.
      Specified by:
      isAnnotatorLogger in interface Logger
      Returns:
      true if this logger is an Annotator logger.
    • setAnnotatorLogger

      public void setAnnotatorLogger(boolean v)
    • debug

      public void debug(String arg0)
      Convert standard call varieties
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(String arg0, Object arg1)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(String arg0, Object... arg1)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(String arg0, Throwable arg1)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(org.slf4j.Marker arg0, String arg1)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(String arg0, Object arg1, Object arg2)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(org.slf4j.Marker arg0, String arg1, Object arg2)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(org.slf4j.Marker arg0, String arg1, Object... arg2)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(org.slf4j.Marker arg0, String arg1, Throwable arg2)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(org.slf4j.Marker arg0, String arg1, Object arg2, Object arg3)
      Specified by:
      debug in interface org.slf4j.Logger
    • debug

      public void debug(Supplier<String> msgSupplier)
      Specified by:
      debug in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
    • debug

      public void debug(Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      debug in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • debug

      public void debug(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
      Specified by:
      debug in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • debug

      public void debug(String message, Supplier<?>... paramSuppliers)
      Specified by:
      debug in interface Logger
      Parameters:
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • debug

      public void debug(org.slf4j.Marker marker, Supplier<String> msgSupplier)
      Specified by:
      debug in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
    • debug

      public void debug(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      debug in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • error

      public void error(String arg0)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(String arg0, Object arg1)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(String arg0, Object... arg1)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(String arg0, Throwable arg1)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(org.slf4j.Marker arg0, String arg1)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(String arg0, Object arg1, Object arg2)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(org.slf4j.Marker arg0, String arg1, Object arg2)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(org.slf4j.Marker arg0, String arg1, Object... arg2)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(org.slf4j.Marker arg0, String arg1, Throwable arg2)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(org.slf4j.Marker arg0, String arg1, Object arg2, Object arg3)
      Specified by:
      error in interface org.slf4j.Logger
    • error

      public void error(Supplier<String> msgSupplier)
      Specified by:
      error in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
    • error

      public void error(Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      error in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • error

      public void error(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
      Specified by:
      error in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • error

      public void error(String message, Supplier<?>... paramSuppliers)
      Specified by:
      error in interface Logger
      Parameters:
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • error

      public void error(org.slf4j.Marker marker, Supplier<String> msgSupplier)
      Specified by:
      error in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
    • error

      public void error(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      error in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • info

      public void info(String arg0)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(String arg0, Object arg1)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(String arg0, Object... arg1)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(String arg0, Throwable arg1)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(org.slf4j.Marker arg0, String arg1)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(String arg0, Object arg1, Object arg2)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(org.slf4j.Marker arg0, String arg1, Object arg2)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(org.slf4j.Marker arg0, String arg1, Object... arg2)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(org.slf4j.Marker arg0, String arg1, Throwable arg2)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(org.slf4j.Marker arg0, String arg1, Object arg2, Object arg3)
      Specified by:
      info in interface org.slf4j.Logger
    • info

      public void info(Supplier<String> msgSupplier)
      Specified by:
      info in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
    • info

      public void info(Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      info in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • info

      public void info(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
      Specified by:
      info in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • info

      public void info(String message, Supplier<?>... paramSuppliers)
      Parameters:
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • info

      public void info(org.slf4j.Marker marker, Supplier<String> msgSupplier)
      Specified by:
      info in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
    • info

      public void info(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      info in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • trace

      public void trace(String arg0)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(String arg0, Object arg1)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(String arg0, Object... arg1)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(String arg0, Throwable arg1)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(org.slf4j.Marker arg0, String arg1)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(String arg0, Object arg1, Object arg2)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(org.slf4j.Marker arg0, String arg1, Object arg2)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(org.slf4j.Marker arg0, String arg1, Object... arg2)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(org.slf4j.Marker arg0, String arg1, Throwable arg2)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(org.slf4j.Marker arg0, String arg1, Object arg2, Object arg3)
      Specified by:
      trace in interface org.slf4j.Logger
    • trace

      public void trace(Supplier<String> msgSupplier)
      Specified by:
      trace in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
    • trace

      public void trace(Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      trace in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • trace

      public void trace(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
      Specified by:
      trace in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • trace

      public void trace(String message, Supplier<?>... paramSuppliers)
      Specified by:
      trace in interface Logger
      Parameters:
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • trace

      public void trace(org.slf4j.Marker marker, Supplier<String> msgSupplier)
      Specified by:
      trace in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
    • trace

      public void trace(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      trace in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • warn

      public void warn(String arg0)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(String arg0, Object arg1)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(String arg0, Object... arg1)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(String arg0, Throwable arg1)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(org.slf4j.Marker arg0, String arg1)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(String arg0, Object arg1, Object arg2)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(org.slf4j.Marker arg0, String arg1, Object arg2)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(org.slf4j.Marker arg0, String arg1, Object... arg2)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(org.slf4j.Marker arg0, String arg1, Throwable arg2)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(org.slf4j.Marker arg0, String arg1, Object arg2, Object arg3)
      Specified by:
      warn in interface org.slf4j.Logger
    • warn

      public void warn(Supplier<String> msgSupplier)
      Specified by:
      warn in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
    • warn

      public void warn(Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      warn in interface Logger
      Parameters:
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log
    • warn

      public void warn(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
      Specified by:
      warn in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • warn

      public void warn(String message, Supplier<?>... paramSuppliers)
      Specified by:
      warn in interface Logger
      Parameters:
      message - the message to log
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • warn

      public void warn(org.slf4j.Marker marker, Supplier<String> msgSupplier)
      Specified by:
      warn in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
    • warn

      public void warn(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
      Specified by:
      warn in interface Logger
      Parameters:
      marker - the marker data specific to this log statement
      msgSupplier - A function, which when called, produces the desired log message
      throwable - the exception to log