Search in sources :

Example 1 with SLF4JLogger

use of org.eclipse.persistence.logging.slf4j.SLF4JLogger in project eclipselink by eclipse-ee4j.

the class SLF4JLoggerTest method testGetLevel.

/**
 * Test {@code SLF4JLogger.getLevel()} method.
 */
@Test
public void testGetLevel() {
    final int configuredDefaultLevel = AbstractSessionLog.getDefaultLoggingLevel();
    final SLF4JLogger logger = new SLF4JLogger();
    final SLF4JLoggerHelper helper = new SLF4JLoggerHelper((AbstractSession) session, loggerContext, logger);
    logger.setSession(session);
    final int defaultLevel = logger.getLevel();
    final String defaultLevelString = LogLevelHelper.logIdToName(defaultLevel);
    assertEquals("SLF4J logging level " + defaultLevelString + " did not match configured level " + configuredDefaultLevel, configuredDefaultLevel, defaultLevel);
    helper.testCategoryDefaultLevels(logger);
}
Also used : SLF4JLogger(org.eclipse.persistence.logging.slf4j.SLF4JLogger) Test(org.junit.Test)

Example 2 with SLF4JLogger

use of org.eclipse.persistence.logging.slf4j.SLF4JLogger in project eclipselink by eclipse-ee4j.

the class SLF4JLoggerTest method testLogExceptionStackTrace.

/**
 * Test {@code SLF4JLogger.log(SessionLogEntry)} method with {@link Throwable} and stack trace logging turned on.
 */
@Test
public void testLogExceptionStackTrace() {
    final SLF4JLogger logger = new SLF4JLogger();
    final SLF4JLoggerHelper helper = new SLF4JLoggerHelper((AbstractSession) session, loggerContext, logger);
    logger.setSession(session);
    logger.setShouldLogExceptionStackTrace(true);
    helper.testLogExceptionStackTrace();
}
Also used : SLF4JLogger(org.eclipse.persistence.logging.slf4j.SLF4JLogger) Test(org.junit.Test)

Example 3 with SLF4JLogger

use of org.eclipse.persistence.logging.slf4j.SLF4JLogger in project eclipselink by eclipse-ee4j.

the class SLF4JLoggerTest method testLogExceptionWithoutStackTrace.

/**
 * Test {@code SLF4JLogger.log(SessionLogEntry)} method with {@link Throwable} and stack trace logging turned off.
 */
@Test
public void testLogExceptionWithoutStackTrace() {
    final SLF4JLogger logger = new SLF4JLogger();
    final SLF4JLoggerHelper helper = new SLF4JLoggerHelper((AbstractSession) session, loggerContext, logger);
    logger.setSession(session);
    logger.setShouldLogExceptionStackTrace(false);
    helper.testLogExceptionWithoutStackTrace();
}
Also used : SLF4JLogger(org.eclipse.persistence.logging.slf4j.SLF4JLogger) Test(org.junit.Test)

Example 4 with SLF4JLogger

use of org.eclipse.persistence.logging.slf4j.SLF4JLogger in project eclipselink by eclipse-ee4j.

the class SLF4JLoggerTest method testLogMessage.

/**
 * Test {@code SLF4JLogger.log(SessionLogEntry)} method with regular {@link String} message.
 */
@Test
public void testLogMessage() {
    final SLF4JLogger logger = new SLF4JLogger();
    final SLF4JLoggerHelper helper = new SLF4JLoggerHelper((AbstractSession) session, loggerContext, logger);
    logger.setSession(session);
    helper.testLogMessage();
}
Also used : SLF4JLogger(org.eclipse.persistence.logging.slf4j.SLF4JLogger) Test(org.junit.Test)

Aggregations

SLF4JLogger (org.eclipse.persistence.logging.slf4j.SLF4JLogger)4 Test (org.junit.Test)4