Package org.apache.uima.util.impl
Class Log4jLogger_impl
java.lang.Object
org.apache.uima.util.impl.Logger_common_impl
org.apache.uima.util.impl.Log4jLogger_impl
- All Implemented Interfaces:
Logger
,org.slf4j.Logger
UIMA Logging interface implementation for Log4j
This version is for Log4j version 2, from Apache
Built using version 2.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.logging.log4j.core.Logger
private static final org.apache.logging.log4j.core.filter.AbstractFilter
private static final org.apache.logging.log4j.core.filter.AbstractFilter
private static final org.apache.logging.log4j.Marker
Markers that are for marking levels not supported by log4j.private static final org.apache.logging.log4j.Marker
private final org.apache.logging.log4j.spi.ExtendedLoggerWrapper
logger object from the underlying Log4j logging framework The ExtendedLoggerWrapper includes the ability to specify the wrapper classprivate final org.apache.logging.log4j.message.MessageFactory
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
Fields inherited from interface org.slf4j.Logger
ROOT_LOGGER_NAME
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Log4jLogger_impl
(Class<?> component) create a new LogWrapper class for the specified source classprivate
Log4jLogger_impl
(Log4jLogger_impl l, int limit) -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.logging.log4j.core.Filter.Result
filterTest
(org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker) static Logger
Creates a new Log4jLogger instance with the default Log4j framework loggerstatic Logger
getInstance
(Class<?> component) Creates a new Log4jLogger instance for the specified source classgetLimitedLogger
(int aLimit) (package private) static org.apache.logging.log4j.Level
getLog4jLevel
(Level level) log4j level mapping to UIMA level mapping.getName()
boolean
boolean
isDebugEnabled
(org.slf4j.Marker arg0) boolean
boolean
isErrorEnabled
(org.slf4j.Marker arg0) boolean
boolean
isInfoEnabled
(org.slf4j.Marker arg0) 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 markerboolean
boolean
isTraceEnabled
(org.slf4j.Marker arg0) boolean
boolean
isWarnEnabled
(org.slf4j.Marker arg0) void
The main log call implemented by subclassesvoid
The version of the main log call implemented by subclasses that skips the substitution because it already was done by rb()void
log2
(org.slf4j.Marker m, String aFqcn, Level level, String message, Object[] args, Throwable thrown) The version of the main log call implemented by subclasses that uses {}, not {n} as the substitutable syntax.private static org.apache.logging.log4j.Marker
m
(org.slf4j.Marker m) private static org.apache.logging.log4j.core.filter.AbstractFilter
makeFilter
(org.apache.logging.log4j.Level tLevel, org.apache.logging.log4j.Marker tMarker) Filters for use in setLevel calls, for levels that need marker filtering.void
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 Details
-
LOG4J_CONFIG
private static final org.apache.logging.log4j.Marker LOG4J_CONFIGMarkers that are for marking levels not supported by log4j.
These are log4j class versions of the slf4j markers.
-
LOG4J_FINEST
private static final org.apache.logging.log4j.Marker LOG4J_FINEST -
FILTER_CONFIG
private static final org.apache.logging.log4j.core.filter.AbstractFilter FILTER_CONFIG -
FILTER_FINEST
private static final org.apache.logging.log4j.core.filter.AbstractFilter FILTER_FINEST -
logger
private final org.apache.logging.log4j.spi.ExtendedLoggerWrapper loggerlogger object from the underlying Log4j logging framework The ExtendedLoggerWrapper includes the ability to specify the wrapper class -
coreLogger
private final org.apache.logging.log4j.core.Logger coreLogger -
mf
private final org.apache.logging.log4j.message.MessageFactory mf
-
-
Constructor Details
-
Log4jLogger_impl
create a new LogWrapper class for the specified source class- Parameters:
component
- specified source class
-
Log4jLogger_impl
-
-
Method Details
-
makeFilter
private static org.apache.logging.log4j.core.filter.AbstractFilter makeFilter(org.apache.logging.log4j.Level tLevel, org.apache.logging.log4j.Marker tMarker) Filters for use in setLevel calls, for levels that need marker filtering.Filters return NEUTRAL unless it's for the associated level. For associated level (e.g., INFO or TRACE), they return ACCEPT if the marker is present DENY otherwise
-
getInstance
Creates a new Log4jLogger instance for the specified source class- Parameters:
component
- current source class- Returns:
- Logger returns the JSR47Logger object for the specified class
-
getInstance
Creates a new Log4jLogger instance with the default Log4j framework logger- Returns:
- Logger returns the JSR47Logger object with the default Log4j framework logger
-
getLimitedLogger
- Parameters:
aLimit
- the limit- Returns:
- a copy of the logger with the throttling limit set, or the same logger if no change
-
getLog4jLevel
log4j level mapping to UIMA level mapping.
SEVERE (highest value) -> SEVERE
WARNING -> WARNING
INFO -> INFO
CONFIG -> INFO
FINE -> DEBUG
FINER -> TRACE
FINEST (lowest value) -> TRACE
OFF -> OFF
ALL -> ALL- Parameters:
level
- uima level- Returns:
- Level - corresponding log4j 2 level
-
m
private static org.apache.logging.log4j.Marker m(org.slf4j.Marker m) -
isLoggable
Description copied from interface:Logger
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
Description copied from interface:Logger
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
-
filterTest
private org.apache.logging.log4j.core.Filter.Result filterTest(org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker) - Parameters:
level
- a log4j level that's equal or above (ERROR is highest) the level being testedmarker
- - the marker that needs to be there to allow this- Returns:
- - the result of running the logger filter test if there is one, else NEUTRAL
-
setLevel
Description copied from interface:Logger
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
-
log
public void log(org.slf4j.Marker m, String aFqcn, Level level, String message, Object[] args, Throwable thrown) Description copied from class:Logger_common_impl
The main log call implemented by subclasses- Specified by:
log
in 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
Description copied from class:Logger_common_impl
The version of the main log call implemented by subclasses that skips the substitution because it already was done by rb()- Specified by:
log
in 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
- -thrown
- - can be null
-
log2
public void log2(org.slf4j.Marker m, String aFqcn, Level level, String message, Object[] args, Throwable thrown) Description copied from class:Logger_common_impl
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.- Specified by:
log2
in 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
-
isDebugEnabled
public boolean isDebugEnabled() -
isDebugEnabled
public boolean isDebugEnabled(org.slf4j.Marker arg0) -
isErrorEnabled
public boolean isErrorEnabled() -
isErrorEnabled
public boolean isErrorEnabled(org.slf4j.Marker arg0) -
isInfoEnabled
public boolean isInfoEnabled() -
isInfoEnabled
public boolean isInfoEnabled(org.slf4j.Marker arg0) -
isTraceEnabled
public boolean isTraceEnabled() -
isTraceEnabled
public boolean isTraceEnabled(org.slf4j.Marker arg0) -
isWarnEnabled
public boolean isWarnEnabled() -
isWarnEnabled
public boolean isWarnEnabled(org.slf4j.Marker arg0)
-