Interface Logger
-
- All Superinterfaces:
org.slf4j.Logger
- All Known Implementing Classes:
JSR47Logger_impl
,Log4jLogger_impl
,Logger_common_impl
,Logger_impl
,Slf4jLogger_impl
public interface Logger extends org.slf4j.Logger
ALogger
is a component used to log messages. This interface defines the standard way for UIMA components to produce log output.In the UIMA SDK, this interface is implemented using the Java logger as a back end.
The back end may be changed to Apache Log4j 2 by specifying
-Dorg.apache.uima.logger.class=org.apache.uima.util.impl.Log4jLogger_impl
and including the log4j 2 JARs in the classpath.If you want to configure the logger, for example to specify the location of the log file and the logging level, you use whatever back end logger implementation specifies, or use that logger's APIs. should use the standard Java logger properties or the java.util.logging APIs. See the section "Specifying the Logging Configuration" in the Annotator and Analysis Engine Developer's Guide chapter of the UIMA documentation for more information.
Version 3 augments this API with methods to do UIMA-Resource-bundle-based internationalization, separate from logging, so the String result can be used with various back end loggers.
Version 3 augments isLoggable to include the Marker.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Marker
UIMA_MARKER_CONFIG
static org.slf4j.Marker
UIMA_MARKER_FINEST
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
debug(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
debug(java.util.function.Supplier<java.lang.String> msgSupplier)
void
debug(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
debug(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
debug(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
void
debug(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
error(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
error(java.util.function.Supplier<java.lang.String> msgSupplier)
void
error(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
error(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
error(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
void
error(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
default Logger
getLimitedLogger(int limit)
void
info(java.util.function.Supplier<java.lang.String> msgSupplier)
void
info(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
info(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
info(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
void
info(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
boolean
isAnnotatorLogger()
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.boolean
isLoggable(Level level)
Checks if the argument level is greater or equal to the specified levelboolean
isLoggable(Level level, org.slf4j.Marker marker)
Checks if this logger is enabled for this level and this markervoid
log(java.lang.String aMessage)
Deprecated.use new function with log levelvoid
log(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments)
Deprecated.use new function with log levelvoid
log(java.lang.String wrapperFQCN, Level level, java.lang.String message, java.lang.Throwable thrown)
Generic logging method intended for logging wrappers.void
log(Level level, java.lang.String aMessage)
Logs a message.void
log(Level level, java.lang.String aMessage, java.lang.Object param1)
Logs a message with one parametervoid
log(Level level, java.lang.String aMessage, java.lang.Object[] params)
Logs a message with an arbitrary number of parametersvoid
log(Level level, java.lang.String aMessage, java.lang.Throwable thrown)
Logs a message and a throwable objectvoid
logException(java.lang.Exception aException)
Deprecated.use new function with log levelvoid
logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey)
Logs a message with a message key.void
logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Object param1)
Logs a message with a message key and one parameter.void
logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Object[] params)
Logs a message with a message key and an arbitrary number of parameters.void
logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Throwable thrown)
Logs a message with a message key and a throwable object.java.lang.String
rb(java.lang.String resourceBundle, java.lang.String key, java.lang.Object... params)
Get an internationalized message from a resource bundle by key name, substituting the parameters.default java.lang.String
rb_ue(java.lang.String key, java.lang.Object... params)
void
setLevel(Level level)
Sets the level of messages that will be logged by this logger.void
setOutputStream(java.io.OutputStream aStream)
Deprecated.use external configuration possibilityvoid
setOutputStream(java.io.PrintStream aStream)
Deprecated.use external configuration possibilityvoid
setResourceManager(ResourceManager resourceManager)
Deprecated.When a logger is used within UIMA, the resource manager is picked up from theUimaContextHolder
and if none is available, then the class loader set on theThread.getContextClassLoader()
is used.void
trace(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
trace(java.util.function.Supplier<java.lang.String> msgSupplier)
void
trace(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
trace(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
trace(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
void
trace(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
warn(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
warn(java.util.function.Supplier<java.lang.String> msgSupplier)
void
warn(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
void
warn(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
void
warn(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
void
warn(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
-
Methods inherited from interface org.slf4j.Logger
debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, error, error, error, error, error, error, error, error, error, error, getName, info, info, info, info, info, info, info, info, info, info, isDebugEnabled, isDebugEnabled, isErrorEnabled, isErrorEnabled, isInfoEnabled, isInfoEnabled, isTraceEnabled, isTraceEnabled, isWarnEnabled, isWarnEnabled, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
-
-
-
-
Method Detail
-
log
@Deprecated void log(java.lang.String aMessage)
Deprecated.use new function with log levelLogs a message.- Parameters:
aMessage
- the message to be logged with message level INFO
-
log
@Deprecated void log(java.lang.String aResourceBundleName, java.lang.String aMessageKey, java.lang.Object[] aArguments)
Deprecated.use new function with log levelLogs an internationalized message.- Parameters:
aResourceBundleName
- base name of resource bundleaMessageKey
- key of message to localize with message level INFOaArguments
- arguments to message (may be null if none)
-
logException
@Deprecated void logException(java.lang.Exception aException)
Deprecated.use new function with log levelLogs an exception- Parameters:
aException
- the exception to be logged with message level INFO
-
setOutputStream
@Deprecated void setOutputStream(java.io.PrintStream aStream)
Deprecated.use external configuration possibilitySets the output stream to which log messages will go. Setting the output stream tonull
will disable the logger.- Parameters:
aStream
-PrintStream
to which log messages will be printed
-
setOutputStream
@Deprecated void setOutputStream(java.io.OutputStream aStream)
Deprecated.use external configuration possibilitySets the output stream to which log messages will go. Setting the output stream tonull
will disable the logger.- Parameters:
aStream
-OutputStream
to which log messages will be printed
-
log
void log(Level level, java.lang.String aMessage)
Logs a message.- Parameters:
level
- message levelaMessage
- the message to be logged
-
log
void log(Level level, java.lang.String aMessage, java.lang.Object param1)
Logs a message with one parameter- Parameters:
level
- message levelaMessage
- the message to be loggedparam1
- message parameter
-
log
void log(Level level, java.lang.String aMessage, java.lang.Object[] params)
Logs a message with an arbitrary number of parameters- Parameters:
level
- message levelaMessage
- the message to be loggedparams
- message parameter array
-
log
void log(Level level, java.lang.String aMessage, java.lang.Throwable thrown)
Logs a message and a throwable object- Parameters:
level
- message levelaMessage
- the message to be loggedthrown
- throwable object
-
logrb
void logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey)
Logs a message with a message key. The real message is extracted from a resource bundle.- Parameters:
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message key
-
logrb
void logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Object param1)
Logs a message with a message key and one parameter. The real message is extracted from a resource bundle.- Parameters:
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keyparam1
- message parameter
-
logrb
void logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Object[] params)
Logs a message with a message key and an arbitrary number of parameters. The real message is extracted from a resource bundle.- Parameters:
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keyparams
- message parameter array with an arbitrary number of parameters
-
logrb
void logrb(Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msgKey, java.lang.Throwable thrown)
Logs a message with a message key and a throwable object. The real message is extracted from a resource bundle.- Parameters:
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keythrown
- throwable object
-
log
void log(java.lang.String wrapperFQCN, Level level, java.lang.String message, java.lang.Throwable thrown)
Generic logging method intended for logging wrappers.- Parameters:
wrapperFQCN
- fully qualified class name of the wrapperlevel
- message levelmessage
- messagethrown
- throwable object
-
isLoggable
boolean isLoggable(Level level)
Checks if the argument level is greater or equal to the specified level- Parameters:
level
- message level- Returns:
- boolean - true if the argument level is greater or equal to the specified level
-
isLoggable
boolean isLoggable(Level level, org.slf4j.Marker marker)
Checks if this logger is enabled for this level and this marker- Parameters:
level
- the level to testmarker
- null or the marker to test- Returns:
- true if the level is greater or equal to the specified level and the marker matches
-
setLevel
void setLevel(Level level)
Sets the level of messages that will be logged by this logger. Note that if you callUIMAFramework.getLogger().setLevel(level)
, this will only change the logging level for messages produced by the UIMA framework. It will NOT change the logging level for messages produced by annotators. To change the logging level for an annotator, useUIMAFramework.getLogger(YourAnnotatorClass.class).setLevel(level)
.If you need more flexibility it configuring the logger, consider using the standard Java logger properties file or the java.util.logging APIs.
- Parameters:
level
- message level
-
setResourceManager
@Deprecated void setResourceManager(ResourceManager resourceManager)
Deprecated.When a logger is used within UIMA, the resource manager is picked up from theUimaContextHolder
and if none is available, then the class loader set on theThread.getContextClassLoader()
is used. Thus, setting a resource manager for loading message localizations should not be required. Setting a resource manager anyway can lead to resource being registered in the resource manager to not be garbage collected in a timely manner. Also, the logger is shared globally and in a multi-threaded/multi-classloader scenario, it is likely that different threads overwrite each others logger resource manager making it likely that in any given thread the wrong resource manager is used by the logger.Sets the ResourceManager to use for message localization. This method is intended for use by the framework, not by user code.- Parameters:
resourceManager
- A resource manager instance whose extension ClassLoader (if any) will be used for message localization by this logger.
-
rb
java.lang.String rb(java.lang.String resourceBundle, java.lang.String key, java.lang.Object... params)
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- Parameters:
resourceBundle
- -key
- -params
- -- Returns:
- the internationalized message
-
rb_ue
default java.lang.String rb_ue(java.lang.String key, java.lang.Object... params)
-
isAnnotatorLogger
boolean isAnnotatorLogger()
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.- Returns:
- true if this logger is an Annotator logger.
-
getLimitedLogger
default Logger getLimitedLogger(int limit)
- Parameters:
limit
- the limit- Returns:
- a copy of the logger with the throttling limit set, or the same logger if no change
-
debug
void debug(java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log message
-
debug
void debug(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
debug
void debug(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
marker
- the marker data specific to this log statementmessage
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
debug
void debug(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
debug
void debug(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log message
-
debug
void debug(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
error
void error(java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log message
-
error
void error(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
error
void error(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
marker
- the marker data specific to this log statementmessage
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
error
void error(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
error
void error(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log message
-
error
void error(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
info
void info(java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log message
-
info
void info(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
info
void info(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
marker
- the marker data specific to this log statementmessage
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
info
void info(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log message
-
info
void info(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
trace
void trace(java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log message
-
trace
void trace(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
trace
void trace(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
marker
- the marker data specific to this log statementmessage
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
trace
void trace(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
trace
void trace(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log message
-
trace
void trace(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
warn
void warn(java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log message
-
warn
void warn(java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
warn
void warn(org.slf4j.Marker marker, java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
marker
- the marker data specific to this log statementmessage
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
warn
void warn(java.lang.String message, java.util.function.Supplier<?>... paramSuppliers)
- Parameters:
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.
-
warn
void warn(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log message
-
warn
void warn(org.slf4j.Marker marker, java.util.function.Supplier<java.lang.String> msgSupplier, java.lang.Throwable throwable)
- Parameters:
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to log
-
-