Package org.apache.uima.util.impl
Class Log4jLogger_impl
java.lang.Object
org.apache.uima.util.impl.Log4jLogger_impl
- All Implemented Interfaces:
Logger
UIMA Logging interface implementation for Log4j
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private org.apache.log4j.Logger
logger object from the underlying Log4j logging frameworkprivate ResourceManager
ResourceManager whose extension ClassLoader will be used to locate the message digests. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
create a new LogWrapper object with the default logger from the Log4j logging frameworkprivate
Log4jLogger_impl
(Class<?> component) create a new LogWrapper class for the specified source class -
Method Summary
Modifier and TypeMethodDescriptionprivate ClassLoader
Gets the extension ClassLoader to used to locate the message digests.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 classprivate org.apache.log4j.Level
getLog4jLevel
(Level level) log4j level mapping to UIMA level mapping.private String[]
getStackTraceInfo
(Throwable thrown) returns the method name and the line number if availableboolean
isLoggable
(Level level) Checks if the argument level is greater or equal to the specified levelvoid
Deprecated.use new function with log levelvoid
Deprecated.use new function with log levelvoid
Generic logging method intended for logging wrappers.void
Logs a message.void
Logs a message with one parametervoid
Logs a message with an arbitrary number of parametersvoid
Logs a message and a throwable objectvoid
logException
(Exception aException) Deprecated.use new function with log levelvoid
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.void
Sets the level of messages that will be logged by this logger.void
Deprecated.use external configuration possibilityvoid
Deprecated.use external configuration possibilityvoid
setResourceManager
(ResourceManager resourceManager) Sets the ResourceManager to use for message localization.
-
Field Details
-
EXCEPTION_MESSAGE
- See Also:
-
logger
private org.apache.log4j.Logger loggerlogger object from the underlying Log4j logging framework -
mResourceManager
ResourceManager whose extension ClassLoader will be used to locate the message digests. Null will cause the ClassLoader to default to this.class.getClassLoader().
-
-
Constructor Details
-
Log4jLogger_impl
create a new LogWrapper class for the specified source class- Parameters:
component
- specified source class
-
Log4jLogger_impl
private Log4jLogger_impl()create a new LogWrapper object with the default logger from the Log4j logging framework
-
-
Method Details
-
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
-
log
Deprecated.use new function with log levelLogs a message with level INFO. -
log
Deprecated.use new function with log levelLogs a message with a message key and the level INFO -
logException
Deprecated.use new function with log levelLogs an exception with level INFO- Specified by:
logException
in interfaceLogger
- Parameters:
aException
- the exception to be logged
-
setOutputStream
Deprecated.use external configuration possibilityDescription copied from interface:Logger
Sets the output stream to which log messages will go. Setting the output stream tonull
will disable the logger.- Specified by:
setOutputStream
in interfaceLogger
- Parameters:
out
-OutputStream
to which log messages will be printed- See Also:
-
setOutputStream
Deprecated.use external configuration possibilityDescription copied from interface:Logger
Sets the output stream to which log messages will go. Setting the output stream tonull
will disable the logger.- Specified by:
setOutputStream
in interfaceLogger
- Parameters:
out
-PrintStream
to which log messages will be printed- See Also:
-
isLoggable
Description copied from interface:Logger
Checks if the argument level is greater or equal to the specified level- Specified by:
isLoggable
in interfaceLogger
- Parameters:
level
- message level- Returns:
- boolean - true if the argument level is greater or equal to the specified level
-
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.
-
log
Description copied from interface:Logger
Logs a message. -
log
Description copied from interface:Logger
Logs a message with one parameter -
log
Description copied from interface:Logger
Logs a message with an arbitrary number of parameters -
log
Description copied from interface:Logger
Logs a message and a 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. -
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. -
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. -
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. -
log
Description copied from interface:Logger
Generic logging method intended for logging wrappers. -
setResourceManager
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 interfaceLogger
- Parameters:
resourceManager
- A resource manager instance whose extension ClassLoader (if any) will be used for message localization by this logger.
-
getExtensionClassLoader
Gets the extension ClassLoader to used to locate the message digests. If this returns null, then message digests will be searched for using this.class.getClassLoader(). -
getLog4jLevel
log4j level mapping to UIMA level mapping. SEVERE (highest value) -> SEVERE WARNING -%gt; WARNING INFO -%gt; INFO CONFIG -%gt; CONFIG FINE -%gt; FINE FINER -> FINER FINEST (lowest value) -%gt; FINEST OFF -%gt; OFF ALL -%gt; ALL- Parameters:
level
- uima level- Returns:
- Level - corresponding JSR47 level
-
getStackTraceInfo
returns the method name and the line number if available- Parameters:
thrown
- the thrown- Returns:
- String[] - fist element is the source class, second element is the method name with linenumber if available
-