public interface Logger
extends org.slf4j.Logger
Logger
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.
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Marker |
UIMA_MARKER_CONFIG |
static org.slf4j.Marker |
UIMA_MARKER_FINEST |
Modifier and Type | Method and Description |
---|---|
void |
debug(org.slf4j.Marker marker,
String message,
Supplier<?>... paramSuppliers) |
void |
debug(org.slf4j.Marker marker,
Supplier<String> msgSupplier) |
void |
debug(org.slf4j.Marker marker,
Supplier<String> msgSupplier,
Throwable throwable) |
void |
debug(String message,
Supplier<?>... paramSuppliers) |
void |
debug(Supplier<String> msgSupplier) |
void |
debug(Supplier<String> msgSupplier,
Throwable throwable) |
void |
error(org.slf4j.Marker marker,
String message,
Supplier<?>... paramSuppliers) |
void |
error(org.slf4j.Marker marker,
Supplier<String> msgSupplier) |
void |
error(org.slf4j.Marker marker,
Supplier<String> msgSupplier,
Throwable throwable) |
void |
error(String message,
Supplier<?>... paramSuppliers) |
void |
error(Supplier<String> msgSupplier) |
void |
error(Supplier<String> msgSupplier,
Throwable throwable) |
default Logger |
getLimitedLogger(int limit) |
void |
info(org.slf4j.Marker marker,
String message,
Supplier<?>... paramSuppliers) |
void |
info(org.slf4j.Marker marker,
Supplier<String> msgSupplier) |
void |
info(org.slf4j.Marker marker,
Supplier<String> msgSupplier,
Throwable throwable) |
void |
info(Supplier<String> msgSupplier) |
void |
info(Supplier<String> msgSupplier,
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 level
|
boolean |
isLoggable(Level level,
org.slf4j.Marker marker)
Checks if this logger is enabled for this level and this marker
|
void |
log(Level level,
String aMessage)
Logs a message.
|
void |
log(Level level,
String aMessage,
Object param1)
Logs a message with one parameter
|
void |
log(Level level,
String aMessage,
Object[] params)
Logs a message with an arbitrary number of parameters
|
void |
log(Level level,
String aMessage,
Throwable thrown)
Logs a message and a throwable object
|
void |
log(String aMessage)
Deprecated.
use new function with log level
|
void |
log(String wrapperFQCN,
Level level,
String message,
Throwable thrown)
Generic logging method intended for logging wrappers.
|
void |
log(String aResourceBundleName,
String aMessageKey,
Object[] aArguments)
Deprecated.
use new function with log level
|
void |
logException(Exception aException)
Deprecated.
use new function with log level
|
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msgKey)
Logs a message with a message key.
|
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msgKey,
Object param1)
Logs a message with a message key and one parameter.
|
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msgKey,
Object[] params)
Logs a message with a message key and an arbitrary number of parameters.
|
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msgKey,
Throwable thrown)
Logs a message with a message key and a throwable object.
|
default String |
rb_ue(String key,
Object... params) |
String |
rb(String resourceBundle,
String key,
Object... params)
Get an internationalized message from a resource bundle by key name, substituting the parameters.
|
void |
setLevel(Level level)
Sets the level of messages that will be logged by this logger.
|
void |
setOutputStream(OutputStream aStream)
Deprecated.
use external configuration possibility
|
void |
setOutputStream(PrintStream aStream)
Deprecated.
use external configuration possibility
|
void |
setResourceManager(ResourceManager resourceManager)
Sets the ResourceManager to use for message localization.
|
void |
trace(org.slf4j.Marker marker,
String message,
Supplier<?>... paramSuppliers) |
void |
trace(org.slf4j.Marker marker,
Supplier<String> msgSupplier) |
void |
trace(org.slf4j.Marker marker,
Supplier<String> msgSupplier,
Throwable throwable) |
void |
trace(String message,
Supplier<?>... paramSuppliers) |
void |
trace(Supplier<String> msgSupplier) |
void |
trace(Supplier<String> msgSupplier,
Throwable throwable) |
void |
warn(org.slf4j.Marker marker,
String message,
Supplier<?>... paramSuppliers) |
void |
warn(org.slf4j.Marker marker,
Supplier<String> msgSupplier) |
void |
warn(org.slf4j.Marker marker,
Supplier<String> msgSupplier,
Throwable throwable) |
void |
warn(String message,
Supplier<?>... paramSuppliers) |
void |
warn(Supplier<String> msgSupplier) |
void |
warn(Supplier<String> msgSupplier,
Throwable throwable) |
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
static final org.slf4j.Marker UIMA_MARKER_CONFIG
static final org.slf4j.Marker UIMA_MARKER_FINEST
@Deprecated void log(String aMessage)
aMessage
- the message to be logged with message level INFO@Deprecated void log(String aResourceBundleName, String aMessageKey, Object[] aArguments)
aResourceBundleName
- base name of resource bundleaMessageKey
- key of message to localize with message level INFOaArguments
- arguments to message (may be null if none)@Deprecated void logException(Exception aException)
aException
- the exception to be logged with message level INFO@Deprecated void setOutputStream(PrintStream aStream)
null
will disable the logger.aStream
- PrintStream
to which log messages will be printed@Deprecated void setOutputStream(OutputStream aStream)
null
will disable the logger.aStream
- OutputStream
to which log messages will be printedvoid log(Level level, String aMessage)
level
- message levelaMessage
- the message to be loggedvoid log(Level level, String aMessage, Object param1)
level
- message levelaMessage
- the message to be loggedparam1
- message parametervoid log(Level level, String aMessage, Object[] params)
level
- message levelaMessage
- the message to be loggedparams
- message parameter arrayvoid log(Level level, String aMessage, Throwable thrown)
level
- message levelaMessage
- the message to be loggedthrown
- throwable objectvoid logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey)
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keyvoid logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Object param1)
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keyparam1
- message parametervoid logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Object[] params)
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keyparams
- message parameter array with an arbitrary number of parametersvoid logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msgKey, Throwable thrown)
level
- message levelsourceClass
- source class namesourceMethod
- source method namebundleName
- resource bundlemsgKey
- message keythrown
- throwable objectvoid log(String wrapperFQCN, Level level, String message, Throwable thrown)
wrapperFQCN
- fully qualified class name of the wrapperlevel
- message levelmessage
- messagethrown
- throwable objectboolean isLoggable(Level level)
level
- message levelboolean isLoggable(Level level, org.slf4j.Marker marker)
level
- the level to testmarker
- null or the marker to testvoid setLevel(Level level)
UIMAFramework.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, use
UIMAFramework.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.
level
- message levelvoid setResourceManager(ResourceManager resourceManager)
resourceManager
- A resource manager instance whose extension ClassLoader (if any) will be used for
message localization by this logger.String rb(String resourceBundle, String key, Object... params)
resourceBundle
- -key
- -params
- -boolean isAnnotatorLogger()
default Logger getLimitedLogger(int limit)
limit
- the limitvoid debug(Supplier<String> msgSupplier)
msgSupplier
- A function, which when called, produces the desired log messagevoid debug(Supplier<String> msgSupplier, Throwable throwable)
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid debug(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
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.void debug(String message, Supplier<?>... paramSuppliers)
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.void debug(org.slf4j.Marker marker, Supplier<String> msgSupplier)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagevoid debug(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid error(Supplier<String> msgSupplier)
msgSupplier
- A function, which when called, produces the desired log messagevoid error(Supplier<String> msgSupplier, Throwable throwable)
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid error(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
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.void error(String message, Supplier<?>... paramSuppliers)
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.void error(org.slf4j.Marker marker, Supplier<String> msgSupplier)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagevoid error(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid info(Supplier<String> msgSupplier)
msgSupplier
- A function, which when called, produces the desired log messagevoid info(Supplier<String> msgSupplier, Throwable throwable)
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid info(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
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.void info(org.slf4j.Marker marker, Supplier<String> msgSupplier)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagevoid info(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid trace(Supplier<String> msgSupplier)
msgSupplier
- A function, which when called, produces the desired log messagevoid trace(Supplier<String> msgSupplier, Throwable throwable)
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid trace(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
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.void trace(String message, Supplier<?>... paramSuppliers)
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.void trace(org.slf4j.Marker marker, Supplier<String> msgSupplier)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagevoid trace(org.slf4j.Marker marker, Supplier<String> msgSupplier, Throwable throwable)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid warn(Supplier<String> msgSupplier)
msgSupplier
- A function, which when called, produces the desired log messagevoid warn(Supplier<String> msgSupplier, Throwable throwable)
msgSupplier
- A function, which when called, produces the desired log messagethrowable
- the exception to logvoid warn(org.slf4j.Marker marker, String message, Supplier<?>... paramSuppliers)
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.void warn(String message, Supplier<?>... paramSuppliers)
message
- the message to logparamSuppliers
- An array of functions, which when called, produce the desired log message parameters.void warn(org.slf4j.Marker marker, Supplier<String> msgSupplier)
marker
- the marker data specific to this log statementmsgSupplier
- A function, which when called, produces the desired log messageCopyright © 2006–2021 The Apache Software Foundation. All rights reserved.