JpaLogger extends AbstractSessionLog { @Override public boolean shouldLog(int level, String category) { return getJavaLogLevel(level).intValue() >= logLevel.intValue(); }  @Override void log(SessionLogEntry sessionLogEntry); @Override void throwing(Throwable throwable); @Override boolean shouldLog(int level, String category); Level getLogLevel(); void setLogLevel(Level logLevel); public Level logLevel; static final Level[] JAVA_LOG_LEVELS; }
@Test public void testShouldLog() throws Exception { JpaLogger logger = new JpaLogger(); Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, "")); Assert.assertTrue(logger.shouldLog(SessionLog.WARNING, "")); Assert.assertFalse(logger.shouldLog(SessionLog.CONFIG, "")); Assert.assertFalse(logger.shouldLog(SessionLog.FINER, "")); Assert.assertFalse(logger.shouldLog(SessionLog.ALL, "")); logger.setLogLevel(Level.FINER); Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, "")); Assert.assertTrue(logger.shouldLog(SessionLog.WARNING, "")); Assert.assertTrue(logger.shouldLog(SessionLog.CONFIG, "")); Assert.assertTrue(logger.shouldLog(SessionLog.FINER, "")); Assert.assertFalse(logger.shouldLog(SessionLog.ALL, "")); logger.setLogLevel(Level.SEVERE); Assert.assertTrue(logger.shouldLog(SessionLog.SEVERE, "")); Assert.assertFalse(logger.shouldLog(SessionLog.WARNING, "")); Assert.assertFalse(logger.shouldLog(SessionLog.CONFIG, "")); Assert.assertFalse(logger.shouldLog(SessionLog.FINER, "")); Assert.assertFalse(logger.shouldLog(SessionLog.ALL, "")); }