Package org.apache.uima.util.impl
Class Slf4jLogger_impl
- java.lang.Object
-
- org.apache.uima.util.impl.Logger_common_impl
-
- org.apache.uima.util.impl.Slf4jLogger_impl
-
- All Implemented Interfaces:
Logger,org.slf4j.Logger
public class Slf4jLogger_impl extends Logger_common_impl
UIMA Logging interface implementation for SLF4j This design gets a logger in static initialization, in order to see what the back end is. If it is JUL or Log4j, it sets flags so that subsequent calls to getInstance gets those UIMA logger impls, not this one, in order to slightly reduce indirection at run time.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_JULstatic booleanIS_DEFAULT_JUL(package private) static booleanisJulprivate booleanisLocationCapable(package private) static booleanisLog4jprivate org.slf4j.Loggerloggerlogger object from the underlying Slf4j logging framework-
Fields inherited from class org.apache.uima.util.impl.Logger_common_impl
EMPTY_STACK_TRACE_INFO, EXCEPTION_MESSAGE, fqcn, fqcnCmn, limit_common
-
Fields inherited from interface org.apache.uima.util.Logger
UIMA_MARKER_CONFIG, UIMA_MARKER_FINEST
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)Slf4jLogger_impl(java.lang.Class<?> component)create a new LogWrapper class for the specified source classprivateSlf4jLogger_impl(Slf4jLogger_impl l, int limit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LoggergetInstance()creates a new Logger instance using default name "org.apache.uima"static LoggergetInstance(java.lang.Class<?> component)creates a new Logger instance for the specified source classSlf4jLogger_implgetLimitedLogger(int aLimit)java.lang.StringgetName()static intgetSlf4jLevel(Level level)booleanisDebugEnabled()booleanisDebugEnabled(org.slf4j.Marker marker)booleanisErrorEnabled()booleanisErrorEnabled(org.slf4j.Marker marker)booleanisInfoEnabled()booleanisInfoEnabled(org.slf4j.Marker marker)booleanisLoggable(Level level)Checks if the argument level is greater or equal to the specified levelbooleanisLoggable(Level level, org.slf4j.Marker marker)Checks if this logger is enabled for this level and this markerbooleanisTraceEnabled()booleanisTraceEnabled(org.slf4j.Marker marker)booleanisWarnEnabled()booleanisWarnEnabled(org.slf4j.Marker marker)voidlog(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String message, java.lang.Object[] args, java.lang.Throwable thrown)The main log call implemented by subclassesvoidlog(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String msg_with_params, java.lang.Throwable thrown)The version of the main log call implemented by subclasses that skips the substitution because it already was done by rb()voidlog2(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String message, java.lang.Object[] args, java.lang.Throwable thrown)The version of the main log call implemented by subclasses that uses {}, not {n} as the substitutable syntax.voidsetLevel(Level level)Sets the level of messages that will be logged by this logger.-
Methods inherited from class org.apache.uima.util.impl.Logger_common_impl
debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, error, error, error, error, error, error, error, error, error, error, error, error, error, error, error, error, getMarkerForLevel, info, info, info, info, info, info, info, info, info, info, info, info, info, info, info, info, isAnnotatorLogger, isEmpty, log, log, log, log, log, log, log, logException, logrb, logrb, logrb, logrb, rb, setAnnotatorLogger, setOutputStream, setOutputStream, setResourceManager, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
-
-
-
-
Field Detail
-
DEFAULT_JUL
public static final java.lang.String DEFAULT_JUL
- See Also:
- Constant Field Values
-
IS_DEFAULT_JUL
public static final boolean IS_DEFAULT_JUL
-
isJul
static final boolean isJul
-
isLog4j
static final boolean isLog4j
-
logger
private final org.slf4j.Logger logger
logger object from the underlying Slf4j logging framework
-
isLocationCapable
private final boolean isLocationCapable
-
-
Constructor Detail
-
Slf4jLogger_impl
Slf4jLogger_impl(java.lang.Class<?> component)
create a new LogWrapper class for the specified source class- Parameters:
component- specified source class
-
Slf4jLogger_impl
private Slf4jLogger_impl(Slf4jLogger_impl l, int limit)
-
-
Method Detail
-
getInstance
public static Logger getInstance(java.lang.Class<?> component)
creates a new Logger instance for the specified source class- Parameters:
component- current source class- Returns:
- Logger - returns the Logger object for the specified class
-
getInstance
public static Logger getInstance()
creates a new Logger instance using default name "org.apache.uima"- Returns:
- Logger - returns the Logger object for the specified class
-
getLimitedLogger
public Slf4jLogger_impl getLimitedLogger(int aLimit)
- Parameters:
aLimit- the limit- Returns:
- a copy of the logger with the throttling limit set, or the same logger if no change
-
getSlf4jLevel
public static int getSlf4jLevel(Level level)
-
isLoggable
public boolean isLoggable(Level level)
Description copied from interface:LoggerChecks 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
public boolean isLoggable(Level level, org.slf4j.Marker marker)
Description copied from interface:LoggerChecks 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
public void setLevel(Level level)
Description copied from interface:LoggerSets 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
-
log
public void log(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String message, java.lang.Object[] args, java.lang.Throwable thrown)Description copied from class:Logger_common_implThe main log call implemented by subclasses- Specified by:
login classLogger_common_impl- Parameters:
m- the markeraFqcn- the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method infolevel- the UIMA levelmessage- -args- - arguments to be substituted into the messagethrown- - can be null
-
log
public void log(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String msg_with_params, java.lang.Throwable thrown)Description copied from class:Logger_common_implThe version of the main log call implemented by subclasses that skips the substitution because it already was done by rb()- Specified by:
login classLogger_common_impl- Parameters:
m- the markeraFqcn- the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method infolevel- the UIMA levelmsg_with_params- -thrown- - can be null
-
log2
public void log2(org.slf4j.Marker m, java.lang.String aFqcn, Level level, java.lang.String message, java.lang.Object[] args, java.lang.Throwable thrown)Description copied from class:Logger_common_implThe 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.- Specified by:
log2in classLogger_common_impl- Parameters:
m- the markeraFqcn- the fully qualified class name of the top-most logging class used to filter the stack trace to get the caller class / method infolevel- the UIMA levelmessage- -args- - arguments to be substituted into the messagethrown- - can be null
-
getName
public java.lang.String getName()
- Returns:
- the logger name
- See Also:
Logger.getName()
-
isTraceEnabled
public boolean isTraceEnabled()
- Returns:
- -
- See Also:
Logger.isTraceEnabled()
-
isTraceEnabled
public boolean isTraceEnabled(org.slf4j.Marker marker)
- Parameters:
marker- -- Returns:
- true if trace is enabled for this marker
- See Also:
Logger.isTraceEnabled(org.slf4j.Marker)
-
isDebugEnabled
public boolean isDebugEnabled()
- Returns:
- -
- See Also:
Logger.isDebugEnabled()
-
isDebugEnabled
public boolean isDebugEnabled(org.slf4j.Marker marker)
- Parameters:
marker- -- Returns:
- true if is enabled for this marker
- See Also:
Logger.isDebugEnabled(org.slf4j.Marker)
-
isInfoEnabled
public boolean isInfoEnabled()
- Returns:
- -
- See Also:
Logger.isInfoEnabled()
-
isInfoEnabled
public boolean isInfoEnabled(org.slf4j.Marker marker)
- Parameters:
marker- -- Returns:
- true if is enabled for this marker
- See Also:
Logger.isInfoEnabled(org.slf4j.Marker)
-
isWarnEnabled
public boolean isWarnEnabled()
- Returns:
- -
- See Also:
Logger.isWarnEnabled()
-
isWarnEnabled
public boolean isWarnEnabled(org.slf4j.Marker marker)
- Parameters:
marker- -- Returns:
- true if is enabled for this marker
- See Also:
Logger.isWarnEnabled(org.slf4j.Marker)
-
isErrorEnabled
public boolean isErrorEnabled()
- Returns:
- -
- See Also:
Logger.isErrorEnabled()
-
isErrorEnabled
public boolean isErrorEnabled(org.slf4j.Marker marker)
- Parameters:
marker- -- Returns:
- true if is enabled for this marker
- See Also:
Logger.isErrorEnabled(org.slf4j.Marker)
-
-