[강운덕] [LUCYSUS-1744] Datasource api중에서 username, pass가 들어가는 api도 추가함. log 수정.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2346 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-09-24 10:25:39 +00:00
parent 206d7d0927
commit 5658e91aad
18 changed files with 32 additions and 24 deletions
@@ -61,7 +61,7 @@ public class CubridConnectionModifier extends AbstractModifier {
return cubridConnection.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -40,7 +40,7 @@ public class CubridDriverModifier extends AbstractModifier {
return mysqlConnection.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -54,7 +54,7 @@ public class CubridPreparedStatementModifier extends AbstractModifier {
return preparedStatementClass.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -78,7 +78,7 @@ public class CubridPreparedStatementModifier extends AbstractModifier {
} catch (NotFoundInstrumentException e) {
// bind variable setter메소드를 못찾을 경우는 그냥 경고만 표시, 에러 아님.
if (logger.isTraceEnabled()) {
logger.trace("bindVariable api not found. Cause:" + e.getMessage(), e);
logger.trace("bindVariable api not found. Cause:{}", e.getMessage(), e);
}
}
}
@@ -35,7 +35,7 @@ public class CubridResultSetModifier extends AbstractModifier {
return resultSetClass.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -52,7 +52,7 @@ public class CubridStatementModifier extends AbstractModifier {
return statementClass.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -33,7 +33,7 @@ public class CubridUStatementModifier extends AbstractModifier {
return ustatementClass.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -7,7 +7,6 @@ import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentClass;
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentException;
import com.nhn.pinpoint.profiler.modifier.AbstractModifier;
import com.nhn.pinpoint.profiler.modifier.db.interceptor.DataSourceGetConnectionInterceptor;
import javassist.CtClass;
import java.security.ProtectionDomain;
@@ -34,13 +33,17 @@ public class DBCPBasicDataSourceModifier extends AbstractModifier {
try {
InstrumentClass basicDataSource = byteCodeInstrumentor.getClass(javassistClassName);
Interceptor interceptor = new DataSourceGetConnectionInterceptor();
basicDataSource.addInterceptor("getConnection", null, interceptor);
Interceptor interceptor1 = new DataSourceGetConnectionInterceptor();
basicDataSource.addInterceptor("getConnection", null, interceptor1);
Interceptor interceptor2 = new DataSourceGetConnectionInterceptor();
basicDataSource.addInterceptor("getConnection", new String[] {"java.lang.String", "java.lang.String"}, interceptor2);
return basicDataSource.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -51,7 +51,12 @@ public class DataSourceGetConnectionInterceptor implements SimpleAroundIntercept
}
try {
trace.recordServiceType(ServiceType.DBCP);
trace.recordApi(descriptor, null);
if (args.length == 2) {
// args[1]은 패스워드라서 뺀다.
trace.recordApi(descriptor, new Object[] {args[0]});
} else {
trace.recordApi(descriptor, null);
}
trace.recordException(result);
trace.markAfterTime();
@@ -77,7 +77,7 @@ public class MySQLConnectionImplModifier extends AbstractModifier {
return mysqlConnection.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -84,7 +84,7 @@ public class MySQLConnectionModifier extends AbstractModifier {
return mysqlConnection.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -50,7 +50,7 @@ public class MySQLNonRegisteringDriverModifier extends AbstractModifier {
return mysqlConnection.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -43,7 +43,7 @@ public class MySQLPreparedStatementJDBC4Modifier extends AbstractModifier {
return preparedStatement.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -59,7 +59,7 @@ public class MySQLPreparedStatementModifier extends AbstractModifier {
return preparedStatement.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -95,7 +95,7 @@ public class MySQLPreparedStatementModifier extends AbstractModifier {
} catch (NotFoundInstrumentException e) {
// bind variable setter메소드를 못찾을 경우는 그냥 경고만 표시, 에러 아님.
if (logger.isTraceEnabled()) {
logger.trace("bindVariable api not found. Cause:" + e.getMessage(), e);
logger.trace("bindVariable api not found. Cause:{}", e.getMessage(), e);
}
}
}
@@ -52,7 +52,7 @@ public class MySQLStatementModifier extends AbstractModifier {
return statementClass.toBytecode();
} catch (InstrumentException e) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " modify fail. Cause:" + e.getMessage(), e);
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
}
return null;
}
@@ -79,7 +79,7 @@ public class OraclePreparedStatementWrapperModifier extends AbstractModifier {
} catch (NotFoundInstrumentException e) {
// bind variable setter메소드를 못찾을 경우는 그냥 경고만 표시, 에러 아님.
if (logger.isTraceEnabled()) {
logger.trace("bindVariable api not found. Cause:" + e.getMessage(), e);
logger.trace("bindVariable api not found. Cause:{}", e.getMessage(), e);
}
}
}
@@ -51,14 +51,14 @@ public class MethodModifier extends AbstractModifier {
for (Method method : methodList) {
Interceptor interceptor = byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.method.interceptor.MethodInterceptor");
if (logger.isTraceEnabled()) {
logger.trace("### c=" + javassistClassName + ", m=" + method.getMethodName() + ", params=" + Arrays.toString(method.getMethodParams()));
logger.trace("### c={}, m={}, params={}", javassistClassName, method.getMethodName(), Arrays.toString(method.getMethodParams()));
}
clazz.addInterceptor(method.getMethodName(), method.getMethodParams(), interceptor);
}
return clazz.toBytecode();
} catch (Exception e) {
logger.warn("modify fail. Cause:" + e.getMessage(), e);
logger.warn("modify fail. Cause:{}", e.getMessage(), e);
return null;
}
}
@@ -47,7 +47,7 @@ public class HttpServletModifier extends AbstractModifier {
return servlet.toBytecode();
} catch (InstrumentException e) {
logger.info("modify fail. Cause:" + e.getMessage(), e);
logger.info("modify fail. Cause:{}", e.getMessage(), e);
return null;
}
}
@@ -53,7 +53,7 @@ public class SpringFrameworkServletModifier extends AbstractModifier {
return servlet.toBytecode();
} catch (InstrumentException e) {
logger.warn("modify fail. Cause:" + e.getMessage(), e);
logger.warn("modify fail. Cause:{}", e.getMessage(), e);
return null;
}
}