Package nva.commons.logutils
Class LogUtils
java.lang.Object
nva.commons.logutils.LogUtils
Deprecated.
Methods for testing logging when using Log4j2 as logging platform. Can be used when using SLF4J
as well with Log4j2 as background logging platform.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TestAppendergetTestingAppender(Class<T> clazz) Deprecated.UseLogRecorder.forClass(Class)instead.static <T> TestAppenderDeprecated.UseLogRecorder.forRoot(Class)instead.static StringtoLoggerName(Class<?> cls) Deprecated.From LogManager.getLogger()
-
Field Details
-
PATTERN_ATTRIBUTE_NAME
Deprecated.- See Also:
-
LOG_CLASS_NAME_AND_MESSAGE
Deprecated.- See Also:
-
ROOT_NULL_APPENDER
Deprecated.- See Also:
-
PACKAGES_WITH_APPENDERS
Deprecated.- See Also:
-
-
Method Details
-
getTestingAppender
Deprecated.UseLogRecorder.forClass(Class)instead.This method should ALWAYS be called before the creation of the object you want to test.The method was created based on the patterns for programmatically configuring Log4j (https://logging.apache.org/log4j/2.x/manual/customconfig.html)
- Type Parameters:
T- The class of the object under test- Parameters:
clazz- The class of the object under test.- Returns:
- a
TestAppender
-
getTestingAppenderForRootLogger
Deprecated.UseLogRecorder.forRoot(Class)instead.This method should ALWAYS be called before the creation of the object you want to test.The method was created based on the patterns for programmatically configuring Log4j (https://logging.apache.org/log4j/2.x/manual/customconfig.html)
- Type Parameters:
T- The class of the object under test- Returns:
- a
TestAppender
-
toLoggerName
Deprecated.From LogManager.getLogger()- Parameters:
cls- the class- Returns:
- the logger name
-
LogRecorderinstead. It captures events without reconfiguring the global Log4j context, returns structuredLogEvents, and avoids side effects on unrelated loggers.