public class LoggerTest extends Object
Logger class, ensuring that it uses Log4J appropriately. The Logger class uses the SLF4J generalized
logging framework, which can sit on top of multiple logging frameworks, including Log4J. Therefore, this test assumes that
SLF4J works correctly for all logging frameworks, then the Logger class can be tested by using it and checking the
resulting Log4J output.
To ensure that the Log4J configuration used in the remaining tests (in src/test/resources/log4j.properties)
does not interfere with this test, the underlying Log4J logger is obtained before each test and programmatically reconfigured
and, after each test, is then restored to it's previous state. This reconfiguration involves identifying and removing all of
the Log4J Appender on the tree of Log4J loggers, and substituting a special Appender that
records the log messages in memory. During the test, this in-memory list of log messages is checked by the test case using
standard assertions to verify the proper order and content of the log messages. After each of the tests, all of the original
Adapters are restored to the appropriate Log4J loggers.
| Modifier and Type | Class and Description |
|---|---|
class |
LoggerTest.LogRecorder
A special Log4J Appender that records log messages and whose content can be
validated to ensure that the log contains
messages in the proper order and with the proper content. |
| Modifier and Type | Field and Description |
|---|---|
static org.modeshape.common.i18n.I18n |
errorMessageWithException |
static org.modeshape.common.i18n.I18n |
errorMessageWithNoParameters |
static org.modeshape.common.i18n.I18n |
errorMessageWithNullException |
static org.modeshape.common.i18n.I18n |
errorMessageWithTwoParameters |
static org.modeshape.common.i18n.I18n |
infoMessageWithException |
static org.modeshape.common.i18n.I18n |
infoMessageWithNoParameters |
static org.modeshape.common.i18n.I18n |
infoMessageWithNullException |
static org.modeshape.common.i18n.I18n |
infoMessageWithTwoParameters |
static org.modeshape.common.i18n.I18n |
someMessage |
static org.modeshape.common.i18n.I18n |
warningMessageWithException |
static org.modeshape.common.i18n.I18n |
warningMessageWithNoParameters |
static org.modeshape.common.i18n.I18n |
warningMessageWithNullException |
static org.modeshape.common.i18n.I18n |
warningMessageWithTwoParameters |
| Constructor and Description |
|---|
LoggerTest() |
public static org.modeshape.common.i18n.I18n errorMessageWithNoParameters
public static org.modeshape.common.i18n.I18n warningMessageWithNoParameters
public static org.modeshape.common.i18n.I18n infoMessageWithNoParameters
public static org.modeshape.common.i18n.I18n errorMessageWithTwoParameters
public static org.modeshape.common.i18n.I18n warningMessageWithTwoParameters
public static org.modeshape.common.i18n.I18n infoMessageWithTwoParameters
public static org.modeshape.common.i18n.I18n errorMessageWithException
public static org.modeshape.common.i18n.I18n warningMessageWithException
public static org.modeshape.common.i18n.I18n infoMessageWithException
public static org.modeshape.common.i18n.I18n errorMessageWithNullException
public static org.modeshape.common.i18n.I18n warningMessageWithNullException
public static org.modeshape.common.i18n.I18n infoMessageWithNullException
public static org.modeshape.common.i18n.I18n someMessage
public LoggerTest()
public static void beforeAll()
public void beforeEach()
public void afterEach()
public void shouldLogAppropriateMessagesIfSetToAllLevel()
public void shouldLogAppropriateMessagesIfLog4jSetToTraceLevel()
public void shouldLogAppropriateMessagesIfLog4jSetToDebugLevel()
public void shouldLogAppropriateMessagesIfLog4jSetToInfoLevel()
public void shouldLogAppropriateMessagesIfLog4jSetToWarningLevel()
public void shouldLogAppropriateMessagesIfLog4jSetToErrorLevel()
public void shouldLogNoMessagesIfLog4jSetToOffLevel()
public void shouldNotAcceptMessageWithNonNullAndNullParameters()
public void shouldNotAcceptErrorMessageWithTooFewParameters()
public void shouldNotAcceptWarningMessageWithTooFewParameters()
public void shouldNotAcceptInfoMessageWithTooFewParameters()
public void shouldNotAcceptDebugMessageWithTooFewParameters()
public void shouldNotAcceptTraceMessageWithTooFewParameters()
public void shouldAcceptMessageWithNoParameters()
public void shouldAcceptMessageWithObjectAndPrimitiveParameters()
public void shouldAcceptMessageAndThrowable()
public void shouldAcceptMessageAndNullThrowable()
public void shouldQuietlyAcceptNullMessage()
public void shouldAcceptNullMessageAndThrowable()
public void shouldAcceptNullThrowableInError()
public void shouldSupportAskingWhetherLoggingLevelsAreEnabled()
Copyright © 2008–2021 JBoss, a division of Red Hat. All rights reserved.