public final class Log4j2LevelAdjuster extends Object implements org.junit.rules.MethodRule
Rule
that changes the Log4J 2 logger level for a set of classes
or packages while a test method is running. Useful for performance or scalability tests
where we don't want to generate a large log in a tight inner loop, or
enabling debug logging for a test case.Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target) |
Log4j2LevelAdjuster |
categories(boolean merge,
String... categories)
Specify the categories for logging level adjusting configured before.
|
Log4j2LevelAdjuster |
categories(String... categoriesToAdjust)
Specify the categories for logging level adjusting configured before.
|
Log4j2LevelAdjuster |
classes(boolean merge,
Class<?>... classesToAdjust)
Specify the classes for logging level adjusting configured before.
|
Log4j2LevelAdjuster |
classes(Class<?>... clazzes)
Specify the classes for logging level adjusting configured before.
|
static Log4j2LevelAdjuster |
debug()
The factory to produce Log4j2LevelAdjuster instances for
Level.DEBUG logging
with the org.springframework.integration as default category. |
static Log4j2LevelAdjuster |
forLevel(org.apache.logging.log4j.Level level)
The factory to produce Log4j2LevelAdjuster instances for arbitrary logging
Level
with the org.springframework.integration as default category. |
static Log4j2LevelAdjuster |
info()
The factory to produce Log4j2LevelAdjuster instances for
Level.INFO logging
with the org.springframework.integration as default category. |
static Log4j2LevelAdjuster |
trace()
The factory to produce Log4j2LevelAdjuster instances for
Level.TRACE logging
with the org.springframework.integration as default category. |
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
apply
in interface org.junit.rules.MethodRule
public Log4j2LevelAdjuster classes(Class<?>... clazzes)
classes
.clazzes
- the classes to use for logging level adjustingpublic Log4j2LevelAdjuster classes(boolean merge, Class<?>... classesToAdjust)
classes
.merge
- to merge or not with previously configured classes
classesToAdjust
- the classes to use for logging level adjustingpublic Log4j2LevelAdjuster categories(String... categoriesToAdjust)
categories
.categoriesToAdjust
- the categories to use for logging level adjustingpublic Log4j2LevelAdjuster categories(boolean merge, String... categories)
categories
.merge
- to merge or not with previously configured categories
categories
- the categories to use for logging level adjustingpublic static Log4j2LevelAdjuster trace()
Level.TRACE
logging
with the org.springframework.integration
as default category.public static Log4j2LevelAdjuster debug()
Level.DEBUG
logging
with the org.springframework.integration
as default category.public static Log4j2LevelAdjuster info()
Level.INFO
logging
with the org.springframework.integration
as default category.public static Log4j2LevelAdjuster forLevel(org.apache.logging.log4j.Level level)
Level
with the org.springframework.integration
as default category.level
- the Level
to use for logging