java.lang.Object
de.cuioss.test.juli.TestLoggerFactory
Central entry point for handling
TestLogHandler- Author:
- Oliver Wolff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLogger(TestLogLevel logLevel, String loggerName) Convenient method for setting a Log-Level in context of the givenTestLogLevelstatic voidConfigures the logger sub-system according to the configuration found withinSystem.getProperties()and / or the file "cui_logger.properties" usually located directly in "src/test/resources".static TestLogHandlerstatic Optional<TestLogHandler>static voidinstall()Adds aTestLogHandlerinstance to jul's root logger.static voidRemoves previously installedTestLogHandlerinstance and restores the previously storedHandler.getLevel().
-
Constructor Details
-
TestLoggerFactory
public TestLoggerFactory()
-
-
Method Details
-
install
Adds aTestLogHandlerinstance to jul's root logger. This method is reentrant, it ensures theTestLogHandleris installed only once -
uninstall
Removes previously installedTestLogHandlerinstance and restores the previously storedHandler.getLevel(). See alsoinstall(). -
configureLogger
Configures the logger sub-system according to the configuration found withinSystem.getProperties()and / or the file "cui_logger.properties" usually located directly in "src/test/resources". -
getTestHandler
- Returns:
- the configured
TestLogHandler - Throws:
AssertionError- in case noTestLogHandlercould be found. This is usually the case ifinstall()was not called prior to this request
-
getTestHandlerOption
- Returns:
- the configured
TestLogHandlerif present
-
addLogger
Convenient method for setting a Log-Level in context of the givenTestLogLevel- Parameters:
logLevel- to be setloggerName- if it isnullor empty it will set the root-logger for the actual Log-Level
-