Examples of Slf4jLogFilter


Examples of com.alibaba.druid.filter.logging.Slf4jLogFilter

    }

    public void test_slf4j() throws Exception {
        dataSource.init();
       
        Slf4jLogFilter filter = dataSource.unwrap(Slf4jLogFilter.class);
        Assert.assertNotNull(filter);
       
        Connection conn = dataSource.getConnection();
        conn.close();
    }
View Full Code Here

Examples of com.alibaba.druid.filter.logging.Slf4jLogFilter

import com.alibaba.druid.filter.logging.Slf4jLogFilter;


public class Slf4jLogFilterTest extends TestCase {
    public void test_slf4j() throws Exception {
        Slf4jLogFilter filter = new Slf4jLogFilter();
        Assert.assertEquals("druid.sql.DataSource", filter.getDataSourceLoggerName());
        Assert.assertEquals("druid.sql.Connection", filter.getConnectionLoggerName());
        Assert.assertEquals("druid.sql.Statement", filter.getStatementLoggerName());
        Assert.assertEquals("druid.sql.ResultSet", filter.getResultSetLoggerName());
       
        filter.setDataSourceLoggerName("x.sql.DataSource");
        filter.setConnectionLoggerName("x.sql.Connection");
        filter.setStatementLoggerName("x.sql.Statement");
        filter.setResultSetLoggerName("x.sql.ResultSet");
       
        Assert.assertEquals("x.sql.DataSource", filter.getDataSourceLoggerName());
        Assert.assertEquals("x.sql.Connection", filter.getConnectionLoggerName());
        Assert.assertEquals("x.sql.Statement", filter.getStatementLoggerName());
        Assert.assertEquals("x.sql.ResultSet", filter.getResultSetLoggerName());
       
        filter.setDataSourceLogger(LoggerFactory.getLogger("y.sql.DataSource"));
        filter.setConnectionLogger(LoggerFactory.getLogger("y.sql.Connection"));
        filter.setStatementLogger(LoggerFactory.getLogger("y.sql.Statement"));
        filter.setResultSetLogger(LoggerFactory.getLogger("y.sql.ResultSet"));
       
        Assert.assertEquals("y.sql.DataSource", filter.getDataSourceLoggerName());
        Assert.assertEquals("y.sql.Connection", filter.getConnectionLoggerName());
        Assert.assertEquals("y.sql.Statement", filter.getStatementLoggerName());
        Assert.assertEquals("y.sql.ResultSet", filter.getResultSetLoggerName());
       
        filter.isDataSourceLogEnabled();
        filter.isConnectionLogEnabled();
        filter.isConnectionLogErrorEnabled();
        filter.isStatementLogEnabled();
        filter.isStatementLogErrorEnabled();
        filter.isResultSetLogEnabled();
        filter.isResultSetLogErrorEnabled();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.