Package de.cuioss.test.juli
Class TestLoggerFactory
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 void
addLogger
(TestLogLevel logLevel, String loggerName) Convenient method for setting a Log-Level in context of the givenTestLogLevel
static void
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".static TestLogHandler
static Optional<TestLogHandler>
static void
install()
Adds aTestLogHandler
instance to jul's root logger.static void
Removes previously installedTestLogHandler
instance and restores the previously storedHandler.getLevel()
.
-
Constructor Details
-
TestLoggerFactory
public TestLoggerFactory()
-
-
Method Details
-
install
Adds aTestLogHandler
instance to jul's root logger. This method is reentrant, it ensures theTestLogHandler
is installed only once -
uninstall
Removes previously installedTestLogHandler
instance 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 noTestLogHandler
could be found. This is usually the case ifinstall()
was not called prior to this request
-
getTestHandlerOption
- Returns:
- the configured
TestLogHandler
if present
-
addLogger
Convenient method for setting a Log-Level in context of the givenTestLogLevel
- Parameters:
logLevel
- to be setloggerName
- if it isnull
or empty it will set the root-logger for the actual Log-Level
-