use of com.alibaba.druid.filter.logging.LogFilter in project druid by alibaba.
the class LogFilterTest4 method test_properties_1.
public void test_properties_1() throws Exception {
System.setProperty("druid.log.conn", "false");
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");
}
}
use of com.alibaba.druid.filter.logging.LogFilter in project druid by alibaba.
the class LogFilterTest4 method test_properties.
public void test_properties() throws Exception {
LogFilter filter = new Log4jFilter();
Assert.assertEquals(true, filter.isConnectionLogEnabled());
Assert.assertEquals(true, filter.isStatementLogEnabled());
Assert.assertEquals(false, filter.isStatementExecutableSqlLogEnable());
Assert.assertEquals(true, filter.isResultSetLogEnabled());
}
Aggregations