System.setProperty("druid.log.stmt", "false");
System.setProperty("druid.log.rs", "false");
System.setProperty("druid.log.stmt.executableSql", "true");
try {
LogFilter filter = new Log4jFilter();
Assert.assertEquals(false, filter.isConnectionLogEnabled());
Assert.assertEquals(false, filter.isStatementLogEnabled());
Assert.assertEquals(true, filter.isStatementExecutableSqlLogEnable());
Assert.assertEquals(false, filter.isResultSetLogEnabled());
Properties properties = new Properties();
properties.setProperty("druid.log.conn", "true");
properties.setProperty("druid.log.stmt", "true");
properties.setProperty("druid.log.rs", "true");
properties.setProperty("druid.log.stmt.executableSql", "false");
filter.configFromProperties(properties);
Assert.assertEquals(true, filter.isConnectionLogEnabled());
Assert.assertEquals(true, filter.isStatementLogEnabled());
Assert.assertEquals(false, filter.isStatementExecutableSqlLogEnable());
Assert.assertEquals(true, filter.isResultSetLogEnabled());
} finally {
System.clearProperty("druid.log.conn");
System.clearProperty("druid.log.stmt");
System.clearProperty("druid.log.rs");
System.clearProperty("druid.log.stmt.executableSql");