Class Log4j2LevelAdjuster
java.lang.Object
org.springframework.integration.test.rule.Log4j2LevelAdjuster
- All Implemented Interfaces:
- org.junit.rules.MethodRule
A JUnit method 
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.- Since:
- 5.0.1
- Author:
- Artem Bilan, Gary Russell
- 
Method SummaryModifier and TypeMethodDescriptionorg.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target) categories(boolean merge, String... categories) Specify the categories for logging level adjusting configured before.categories(String... categoriesToAdjust) Specify the categories for logging level adjusting configured before.Specify the classes for logging level adjusting configured before.Specify the classes for logging level adjusting configured before.static Log4j2LevelAdjusterdebug()The factory to produce Log4j2LevelAdjuster instances forLevel.DEBUGlogging with theorg.springframework.integrationas default category.static Log4j2LevelAdjusterforLevel(org.apache.logging.log4j.Level level) The factory to produce Log4j2LevelAdjuster instances for arbitrary loggingLevelwith theorg.springframework.integrationas default category.static Log4j2LevelAdjusterinfo()The factory to produce Log4j2LevelAdjuster instances forLevel.INFOlogging with theorg.springframework.integrationas default category.static Log4j2LevelAdjustertrace()The factory to produce Log4j2LevelAdjuster instances forLevel.TRACElogging with theorg.springframework.integrationas default category.
- 
Method Details- 
applypublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target) - Specified by:
- applyin interface- org.junit.rules.MethodRule
 
- 
classesSpecify the classes for logging level adjusting configured before. A new copy Log4j2LevelAdjuster instance is produced by this method. The provided classes parameter overrides existing value in theclasses.- Parameters:
- clazzes- the classes to use for logging level adjusting
- Returns:
- a Log4j2LevelAdjuster copy with the provided classes
 
- 
classesSpecify the classes for logging level adjusting configured before. A new copy Log4j2LevelAdjuster instance is produced by this method. The provided classes parameter can be merged with existing value in theclasses.- Parameters:
- merge- to merge or not with previously configured- classes
- classesToAdjust- the classes to use for logging level adjusting
- Returns:
- a Log4j2LevelAdjuster copy with the provided classes
- Since:
- 5.0.2
 
- 
categoriesSpecify the categories for logging level adjusting configured before. A new copy Log4j2LevelAdjuster instance is produced by this method. The provided categories parameter overrides existing value in thecategories.- Parameters:
- categoriesToAdjust- the categories to use for logging level adjusting
- Returns:
- a Log4j2LevelAdjuster copy with the provided categories
 
- 
categoriesSpecify the categories for logging level adjusting configured before. A new copy Log4j2LevelAdjuster instance is produced by this method. The provided categories parameter can be merged with existing value in thecategories.- Parameters:
- merge- to merge or not with previously configured- categories
- categories- the categories to use for logging level adjusting
- Returns:
- a Log4j2LevelAdjuster copy with the provided categories
- Since:
- 5.0.2
 
- 
traceThe factory to produce Log4j2LevelAdjuster instances forLevel.TRACElogging with theorg.springframework.integrationas default category.- Returns:
- the Log4j2LevelAdjuster instance
 
- 
debugThe factory to produce Log4j2LevelAdjuster instances forLevel.DEBUGlogging with theorg.springframework.integrationas default category.- Returns:
- the Log4j2LevelAdjuster instance
 
- 
infoThe factory to produce Log4j2LevelAdjuster instances forLevel.INFOlogging with theorg.springframework.integrationas default category.- Returns:
- the Log4j2LevelAdjuster instance
 
- 
forLevelThe factory to produce Log4j2LevelAdjuster instances for arbitrary loggingLevelwith theorg.springframework.integrationas default category.- Parameters:
- level- the- Levelto use for logging
- Returns:
- the Log4j2LevelAdjuster instance
 
 
-