From 786c97cd0e5922bb6239ab3332c451f4f7065a5a Mon Sep 17 00:00:00 2001 From: juicer Date: Fri, 27 Nov 2015 17:27:19 +0800 Subject: [PATCH 1/3] Update OracleInsertStatement.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复解析oracle insert 语句后获取其SQLStatement实例对象toString()方法获取真实SQL语句~ --- .../oracle/ast/stmt/OracleInsertStatement.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java b/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java index 5fecfdfc9f..547440814d 100644 --- a/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java +++ b/src/main/java/com/alibaba/druid/sql/dialect/oracle/ast/stmt/OracleInsertStatement.java @@ -62,14 +62,18 @@ public class OracleInsertStatement extends SQLInsertStatement implements OracleS public void accept0(OracleASTVisitor visitor) { if (visitor.visit(this)) { - this.acceptChild(visitor, tableSource); - this.acceptChild(visitor, columns); - this.acceptChild(visitor, values); - this.acceptChild(visitor, query); + this.acceptChild(visitor, getTableSource()); + this.acceptChild(visitor, getColumns()); + this.acceptChild(visitor, getValues()); + this.acceptChild(visitor, getQuery()); this.acceptChild(visitor, returning); this.acceptChild(visitor, errorLogging); } visitor.endVisit(this); } + + public void output(StringBuffer buf) { + new OracleOutputVisitor(buf).visit(this); + } } From 3eb0b61549d514b2a8a68646681e3e83415a822c Mon Sep 17 00:00:00 2001 From: laogao Date: Mon, 30 Nov 2015 14:41:42 +0800 Subject: [PATCH 2/3] DruidDataSource.getStatDataForMBean() should use getActiveCount for ActiveCount, just as getStatData() does. --- src/main/java/com/alibaba/druid/pool/DruidDataSource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java index 1ebeec5273..b1fb5a93f6 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java +++ b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java @@ -2170,7 +2170,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat // 5 - 9 map.put("CloseCount", this.getCloseCount()); - map.put("ActiveCount", this.getActivePeak()); + map.put("ActiveCount", this.getActiveCount()); map.put("PoolingCount", this.getPoolingCount()); map.put("LockQueueLength", this.getLockQueueLength()); map.put("WaitThreadCount", this.getNotEmptyWaitThreadPeak()); From ee2deb487f1bbf182852cf68b56f75bb1c77cbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=A0=E6=B3=A2?= Date: Tue, 8 Dec 2015 21:13:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=B3=BB=E7=BB=9F=E5=8F=98=E9=87=8F=E6=9D=A5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=97=A5=E5=BF=97=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../druid/support/logging/LogFactory.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/alibaba/druid/support/logging/LogFactory.java b/src/main/java/com/alibaba/druid/support/logging/LogFactory.java index 2a1114a8f3..0390d73bf3 100644 --- a/src/main/java/com/alibaba/druid/support/logging/LogFactory.java +++ b/src/main/java/com/alibaba/druid/support/logging/LogFactory.java @@ -23,8 +23,21 @@ public class LogFactory { private static Constructor logConstructor; static { - // TODO add slf4j logging - + String logType= System.getProperty("druid.logType"); + if(logType != null){ + if(logType.equalsIgnoreCase("slf4j")){ + tryImplementation("org.slf4j.Logger", "com.alibaba.druid.support.logging.SLF4JImpl"); + }else if(logType.equalsIgnoreCase("log4j")){ + tryImplementation("org.apache.log4j.Logger", "com.alibaba.druid.support.logging.Log4jImpl"); + }else if(logType.equalsIgnoreCase("log4j2")){ + tryImplementation("org.apache.logging.log4j.Logger", "com.alibaba.druid.support.logging.Log4j2Impl"); + }else if(logType.equalsIgnoreCase("commonsLog")){ + tryImplementation("org.apache.commons.logging.LogFactory", + "com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl"); + }else if(logType.equalsIgnoreCase("jdkLog")){ + tryImplementation("java.util.logging.Logger", "com.alibaba.druid.support.logging.Jdk14LoggingImpl"); + } + } // 优先选择log4j,而非Apache Common Logging. 因为后者无法设置真实Log调用者的信息 tryImplementation("org.apache.log4j.Logger", "com.alibaba.druid.support.logging.Log4jImpl"); tryImplementation("org.apache.logging.log4j.Logger", "com.alibaba.druid.support.logging.Log4j2Impl");