use of org.apache.logging.log4j.util.MessageSupplier in project logging-log4j2 by apache.
the class AbstractLoggerTest method testMessageSupplierWithoutThrowable.
@Test
public void testMessageSupplierWithoutThrowable() {
final ThrowableExpectingLogger logger = new ThrowableExpectingLogger(false);
final ThrowableMessage message = new ThrowableMessage(null);
final MessageSupplier supplier = new MessageSupplier() {
@Override
public Message get() {
return message;
}
};
logger.debug(supplier);
logger.error(supplier);
logger.fatal(supplier);
logger.info(supplier);
logger.trace(supplier);
logger.warn(supplier);
logger.log(Level.INFO, supplier);
logger.debug(MARKER, supplier);
logger.error(MARKER, supplier);
logger.fatal(MARKER, supplier);
logger.info(MARKER, supplier);
logger.trace(MARKER, supplier);
logger.warn(MARKER, supplier);
logger.log(Level.INFO, MARKER, supplier);
}
use of org.apache.logging.log4j.util.MessageSupplier in project logging-log4j2 by apache.
the class AbstractLoggerTest method testMessageSupplierWithThrowable.
@Test
public void testMessageSupplierWithThrowable() {
final ThrowableExpectingLogger logger = new ThrowableExpectingLogger(true);
final ThrowableMessage message = new ThrowableMessage(t);
final MessageSupplier supplier = new MessageSupplier() {
@Override
public Message get() {
return message;
}
};
logger.debug(supplier);
logger.error(supplier);
logger.fatal(supplier);
logger.info(supplier);
logger.trace(supplier);
logger.warn(supplier);
logger.log(Level.INFO, supplier);
logger.debug(MARKER, supplier);
logger.error(MARKER, supplier);
logger.fatal(MARKER, supplier);
logger.info(MARKER, supplier);
logger.trace(MARKER, supplier);
logger.warn(MARKER, supplier);
logger.log(Level.INFO, MARKER, supplier);
}
Aggregations