mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor logFilter
This commit is contained in:
@@ -24,11 +24,6 @@ import org.apache.commons.logging.impl.Log4JLogger;
|
||||
*/
|
||||
public class CommonsLogFilter extends LogFilter {
|
||||
|
||||
private String dataSourceLoggerName = "druid.sql.DataSource";
|
||||
private String connectionLoggerName = "druid.sql.Connection";
|
||||
private String statementLoggerName = "druid.sql.Statement";
|
||||
private String resultSetLoggerName = "druid.sql.ResultSet";
|
||||
|
||||
private Log dataSourceLogger = LogFactory.getLog(dataSourceLoggerName);
|
||||
private Log connectionLogger = LogFactory.getLog(connectionLoggerName);
|
||||
private Log statementLogger = LogFactory.getLog(statementLoggerName);
|
||||
|
||||
@@ -23,15 +23,10 @@ import org.apache.log4j.Logger;
|
||||
*/
|
||||
public class Log4jFilter extends LogFilter implements Log4jFilterMBean {
|
||||
|
||||
private String dataSourceLoggerName = "druid.sql.DataSource";
|
||||
private String connectionLoggerName = "druid.sql.Connection";
|
||||
private String statementLoggerName = "druid.sql.Statement";
|
||||
private String resultSetLoggerName = "druid.sql.ResultSet";
|
||||
|
||||
private Logger dataSourceLogger = Logger.getLogger(dataSourceLoggerName);
|
||||
private Logger connectionLogger = Logger.getLogger(connectionLoggerName);
|
||||
private Logger statementLogger = Logger.getLogger(statementLoggerName);
|
||||
private Logger resultSetLogger = Logger.getLogger(resultSetLoggerName);
|
||||
private Logger dataSourceLogger = Logger.getLogger(dataSourceLoggerName);
|
||||
private Logger connectionLogger = Logger.getLogger(connectionLoggerName);
|
||||
private Logger statementLogger = Logger.getLogger(statementLoggerName);
|
||||
private Logger resultSetLogger = Logger.getLogger(resultSetLoggerName);
|
||||
|
||||
@Override
|
||||
public String getDataSourceLoggerName() {
|
||||
|
||||
@@ -37,6 +37,11 @@ import com.alibaba.druid.util.JdbcUtils;
|
||||
*/
|
||||
public abstract class LogFilter extends FilterEventAdapter implements LogFilterMBean {
|
||||
|
||||
protected String dataSourceLoggerName = "druid.sql.DataSource";
|
||||
protected String connectionLoggerName = "druid.sql.Connection";
|
||||
protected String statementLoggerName = "druid.sql.Statement";
|
||||
protected String resultSetLoggerName = "druid.sql.ResultSet";
|
||||
|
||||
private boolean connectionConnectBeforeLogEnable = true;
|
||||
private boolean connectionConnectAfterLogEnable = true;
|
||||
private boolean connectionCommitAfterLogEnable = true;
|
||||
|
||||
@@ -5,15 +5,10 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Slf4jLogFilter extends LogFilter {
|
||||
|
||||
private String dataSourceLoggerName = "druid.sql.DataSource";
|
||||
private String connectionLoggerName = "druid.sql.Connection";
|
||||
private String statementLoggerName = "druid.sql.Statement";
|
||||
private String resultSetLoggerName = "druid.sql.ResultSet";
|
||||
|
||||
private Logger dataSourceLogger = LoggerFactory.getLogger(dataSourceLoggerName);
|
||||
private Logger connectionLogger = LoggerFactory.getLogger(connectionLoggerName);
|
||||
private Logger statementLogger = LoggerFactory.getLogger(statementLoggerName);
|
||||
private Logger resultSetLogger = LoggerFactory.getLogger(resultSetLoggerName);
|
||||
private Logger dataSourceLogger = LoggerFactory.getLogger(dataSourceLoggerName);
|
||||
private Logger connectionLogger = LoggerFactory.getLogger(connectionLoggerName);
|
||||
private Logger statementLogger = LoggerFactory.getLogger(statementLoggerName);
|
||||
private Logger resultSetLogger = LoggerFactory.getLogger(resultSetLoggerName);
|
||||
|
||||
@Override
|
||||
public String getDataSourceLoggerName() {
|
||||
|
||||
Reference in New Issue
Block a user