mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-16 16:28:48 +10:00
[강운덕] [LUCYSUS-1744] interceptor의 before, after 로그레벨을 INFO에서 FINE으로 변경함. before, after로깅시 Level 체크 로직을 한번만 수행하도록 변경.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1142 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.profiler.logging;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class LoggingUtils {
|
||||
|
||||
public static boolean isDebug(Logger logger) {
|
||||
return logger.isLoggable(Level.FINE);
|
||||
}
|
||||
|
||||
public static void before(Logger logger, String method) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.profiler.modifier.arcus.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import net.spy.memcached.MemcachedClient;
|
||||
import net.spy.memcached.ops.Operation;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.profiler.util.StringUtils;
|
||||
public class AddOpInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(AddOpInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MetaObject<String> getServiceCode = new MetaObject<String>("__getServiceCode");
|
||||
private MetaObject<String> setServiceCode = new MetaObject<String>("__setServiceCode", String.class);
|
||||
@@ -27,8 +28,8 @@ public class AddOpInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
String serviceCode = getServiceCode.invoke((MemcachedClient) target);
|
||||
|
||||
+5
-3
@@ -1,9 +1,9 @@
|
||||
package com.profiler.modifier.arcus.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import net.spy.memcached.protocol.BaseOperationImpl;
|
||||
|
||||
import com.profiler.context.AsyncTrace;
|
||||
@@ -17,12 +17,14 @@ import com.profiler.util.StringUtils;
|
||||
public class BaseOperationCancelInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(BaseOperationCancelInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MetaObject getAsyncTrace = new MetaObject("__getAsyncTrace");
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
AsyncTrace asyncTrace = (AsyncTrace) getAsyncTrace.invoke(target);
|
||||
|
||||
+5
-3
@@ -2,11 +2,11 @@ package com.profiler.modifier.arcus.interceptors;
|
||||
|
||||
import com.profiler.context.*;
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@@ -15,12 +15,14 @@ import java.util.logging.Logger;
|
||||
public class BaseOperationConstructInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(BaseOperationConstructInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MetaObject<Object> setAsyncTrace = new MetaObject<Object>("__setAsyncTrace", Object.class);
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
|
||||
+4
-2
@@ -8,6 +8,7 @@ import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import net.spy.memcached.MemcachedNode;
|
||||
import net.spy.memcached.ops.OperationState;
|
||||
import net.spy.memcached.protocol.BaseOperationImpl;
|
||||
@@ -25,6 +26,7 @@ import com.profiler.util.StringUtils;
|
||||
public class BaseOperationTransitionStateInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(BaseOperationTransitionStateInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
|
||||
@@ -33,8 +35,8 @@ public class BaseOperationTransitionStateInterceptor implements StaticBeforeInte
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
AsyncTrace asyncTrace = (AsyncTrace) getAsyncTrace.invoke(target);
|
||||
|
||||
+5
-3
@@ -1,10 +1,10 @@
|
||||
package com.profiler.modifier.arcus.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
@@ -16,12 +16,14 @@ import com.profiler.util.StringUtils;
|
||||
public class CacheManagerConstructInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(CacheManagerConstructInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MetaObject<Object> setServiceCode = new MetaObject<Object>("__setServiceCode", String.class);
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
|
||||
setServiceCode.invoke(target, (String) args[1]);
|
||||
|
||||
+4
-3
@@ -1,9 +1,9 @@
|
||||
package com.profiler.modifier.arcus.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import net.spy.memcached.CacheManager;
|
||||
import net.spy.memcached.MemcachedClient;
|
||||
|
||||
@@ -19,14 +19,15 @@ import com.profiler.util.StringUtils;
|
||||
public class SetCacheManagerInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(SetCacheManagerInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MetaObject<String> getServiceCode = new MetaObject<String>("__getServiceCode");
|
||||
private MetaObject<String> setServiceCode = new MetaObject<String>("__setServiceCode", String.class);
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
CacheManager cm = (CacheManager) args[0];
|
||||
|
||||
+8
-6
@@ -13,10 +13,10 @@ import com.profiler.context.SpanID;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.context.TraceID;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.NumberUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
@@ -26,13 +26,15 @@ import com.profiler.util.StringUtils;
|
||||
public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(ExecuteMethodInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
// private int apiId;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -82,9 +84,9 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
// logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
// logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
|
||||
+7
-5
@@ -2,9 +2,9 @@ package com.profiler.modifier.connector.interceptors;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
|
||||
@@ -32,12 +32,14 @@ import com.profiler.util.StringUtils;
|
||||
public class Execute2MethodInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(Execute2MethodInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
Trace trace = traceContext.currentTraceObject();
|
||||
@@ -70,8 +72,8 @@ public class Execute2MethodInterceptor implements StaticAroundInterceptor, ByteC
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
|
||||
+7
-5
@@ -1,9 +1,9 @@
|
||||
package com.profiler.modifier.connector.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
|
||||
@@ -35,13 +35,15 @@ import com.profiler.util.StringUtils;
|
||||
public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(ExecuteMethodInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
// private int apiId;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
Trace trace = traceContext.currentTraceObject();
|
||||
@@ -72,8 +74,8 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
package com.profiler.modifier.db.interceptor;
|
||||
|
||||
import com.profiler.interceptor.StaticBeforeInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ConnectionCloseInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(ConnectionCloseInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private static final Object[] EMPTY = new Object[]{null};
|
||||
|
||||
private final MetaObject setUrl = new MetaObject("__setUrl", Object.class);
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
|
||||
+6
-5
@@ -1,12 +1,12 @@
|
||||
package com.profiler.modifier.db.interceptor;
|
||||
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.InterceptorUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@@ -15,18 +15,19 @@ import java.util.logging.Logger;
|
||||
public class DataSourceGetConnectionInterceptor implements StaticAroundInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(DataSourceGetConnectionInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
|
||||
if (!InterceptorUtils.isSuccess(result)) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.modifier.db.util.JDBCUrlParser;
|
||||
import com.profiler.util.InterceptorUtils;
|
||||
@@ -21,6 +22,8 @@ import java.util.logging.Logger;
|
||||
public class DriverConnectInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(DriverConnectInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject setUrl = new MetaObject("__setUrl", Object.class);
|
||||
|
||||
private JDBCUrlParser urlParser = new JDBCUrlParser();
|
||||
@@ -30,10 +33,8 @@ public class DriverConnectInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
logger.fine("JDBCScope push:" + Thread.currentThread().getName());
|
||||
}
|
||||
JDBCScope.pushScope();
|
||||
@@ -50,10 +51,8 @@ public class DriverConnectInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
logger.fine("JDBCScope pop:" + Thread.currentThread().getName());
|
||||
}
|
||||
// 여기서는 trace context인지 아닌지 확인하면 안된다. trace 대상 thread가 아닌곳에서 connection이 생성될수 있음.
|
||||
|
||||
+6
-3
@@ -3,6 +3,7 @@ package com.profiler.modifier.db.interceptor;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.NumberUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
@@ -15,17 +16,19 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PreparedStatementBindVariableInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(PreparedStatementBindVariableInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject<Map> getBindValue = new MetaObject<Map>("__getBindValue");
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+9
-7
@@ -4,6 +4,7 @@ import com.profiler.common.util.ParsingResult;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.*;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.InterceptorUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
@@ -11,11 +12,12 @@ import com.profiler.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PreparedStatementCreateInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(PreparedStatementCreateInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
|
||||
@@ -28,11 +30,11 @@ public class PreparedStatementCreateInterceptor implements StaticAroundIntercept
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
@@ -51,11 +53,11 @@ public class PreparedStatementCreateInterceptor implements StaticAroundIntercept
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
if (!InterceptorUtils.isSuccess(result)) {
|
||||
|
||||
+7
-6
@@ -11,10 +11,10 @@ import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.util.ParsingResult;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
@@ -22,6 +22,7 @@ import com.profiler.util.StringUtils;
|
||||
public class PreparedStatementExecuteQueryInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(PreparedStatementExecuteQueryInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject<Object> getSql = new MetaObject<Object>("__getSql");
|
||||
private final MetaObject<Object> getUrl = new MetaObject<Object>("__getUrl");
|
||||
@@ -33,11 +34,11 @@ public class PreparedStatementExecuteQueryInterceptor implements StaticAroundInt
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
@@ -93,8 +94,8 @@ public class PreparedStatementExecuteQueryInterceptor implements StaticAroundInt
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
return;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.profiler.modifier.db.interceptor;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.InterceptorUtils;
|
||||
import com.profiler.util.MetaObject;
|
||||
@@ -10,12 +11,12 @@ import com.profiler.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class StatementCreateInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StatementCreateInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
// connection 용.
|
||||
private final MetaObject<Object> getUrl = new MetaObject<Object>("__getUrl");
|
||||
@@ -24,11 +25,11 @@ public class StatementCreateInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
if (!InterceptorUtils.isSuccess(result)) {
|
||||
|
||||
+7
-5
@@ -5,6 +5,7 @@ import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
@@ -19,17 +20,18 @@ import java.util.logging.Logger;
|
||||
public class StatementExecuteQueryInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StatementExecuteQueryInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject<Object> getUrl = new MetaObject<Object>("__getUrl");
|
||||
private MethodDescriptor descriptor;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
@@ -59,8 +61,8 @@ public class StatementExecuteQueryInterceptor implements StaticAroundInterceptor
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
return;
|
||||
|
||||
+6
-6
@@ -1,12 +1,11 @@
|
||||
package com.profiler.modifier.db.interceptor;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
@@ -23,6 +22,7 @@ import java.util.logging.Logger;
|
||||
public class StatementExecuteUpdateInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StatementExecuteUpdateInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject<Object> getUrl = new MetaObject<Object>("__getUrl");
|
||||
// private int apiId;
|
||||
@@ -30,11 +30,11 @@ public class StatementExecuteUpdateInterceptor implements StaticAroundIntercepto
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
if (isDebug) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
logger.fine("internal jdbc scope. skip trace");
|
||||
return;
|
||||
}
|
||||
TraceContext traceContext = TraceContext.getTraceContext();
|
||||
@@ -67,8 +67,8 @@ public class StatementExecuteUpdateInterceptor implements StaticAroundIntercepto
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
return;
|
||||
|
||||
@@ -7,10 +7,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
@@ -18,14 +18,15 @@ import com.profiler.util.StringUtils;
|
||||
public class TransactionInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(TransactionInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private final MetaObject<Object> getUrl = new MetaObject<Object>("__getUrl");
|
||||
private MethodDescriptor descriptor;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
logger.info("internal jdbc scope. skip trace");
|
||||
@@ -50,8 +51,8 @@ public class TransactionInterceptor implements StaticAroundInterceptor, ByteCode
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
if (JDBCScope.isInternal()) {
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.profiler.modifier.dummy;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.Agent;
|
||||
@@ -9,6 +8,7 @@ import com.profiler.interceptor.Interceptor;
|
||||
import com.profiler.interceptor.bci.ByteCodeInstrumentor;
|
||||
import com.profiler.interceptor.bci.InstrumentClass;
|
||||
import com.profiler.interceptor.bci.InstrumentException;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.AbstractModifier;
|
||||
|
||||
/**
|
||||
@@ -17,6 +17,7 @@ import com.profiler.modifier.AbstractModifier;
|
||||
public class DummyModifier extends AbstractModifier {
|
||||
|
||||
private final Logger logger = Logger.getLogger(DummyModifier.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
public DummyModifier(ByteCodeInstrumentor byteCodeInstrumentor, Agent agent) {
|
||||
super(byteCodeInstrumentor, agent);
|
||||
@@ -27,8 +28,8 @@ public class DummyModifier extends AbstractModifier {
|
||||
}
|
||||
|
||||
public byte[] modify(ClassLoader classLoader, String javassistClassName, ProtectionDomain protectedDomain, byte[] classFileBuffer) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("Modifing. " + javassistClassName);
|
||||
if (isDebug) {
|
||||
logger.fine("Modifing. " + javassistClassName);
|
||||
}
|
||||
|
||||
byteCodeInstrumentor.checkLibrary(classLoader, javassistClassName);
|
||||
|
||||
@@ -7,11 +7,11 @@ import java.util.logging.Logger;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.interceptor.TraceContextSupport;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -22,13 +22,15 @@ import com.profiler.util.StringUtils;
|
||||
public class MethodInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport, TraceContextSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(MethodInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
private TraceContext traceContext;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
Trace trace = TraceContext.getTraceContext().currentTraceObject();
|
||||
|
||||
@@ -15,17 +15,19 @@ import com.profiler.context.SpanID;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.context.TraceID;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.interceptor.TraceContextSupport;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.NumberUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
public class DoXXXInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport, TraceContextSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(DoXXXInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
private TraceContext traceContext;
|
||||
|
||||
@@ -55,8 +57,8 @@ public class DoXXXInterceptor implements StaticAroundInterceptor, ByteCodeMethod
|
||||
*/
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -102,8 +104,8 @@ public class DoXXXInterceptor implements StaticAroundInterceptor, ByteCodeMethod
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
|
||||
traceContext.getActiveThreadCounter().end();
|
||||
|
||||
+4
-3
@@ -1,11 +1,11 @@
|
||||
package com.profiler.modifier.tomcat.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.Agent;
|
||||
import com.profiler.interceptor.StaticBeforeInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.Assert;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.profiler.util.StringUtils;
|
||||
public class CatalinaAwaitInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
private Logger logger = Logger.getLogger(this.getClass().getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private Agent agent;
|
||||
|
||||
@@ -25,8 +26,8 @@ public class CatalinaAwaitInterceptor implements StaticBeforeInterceptor {
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
agent.sendStartupInfo();
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,9 +1,9 @@
|
||||
package com.profiler.modifier.tomcat.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
|
||||
import com.profiler.Agent;
|
||||
@@ -17,6 +17,7 @@ import com.profiler.util.StringUtils;
|
||||
public class ConnectorInitializeInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private Logger logger = Logger.getLogger(this.getClass().getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private Agent agent;
|
||||
|
||||
@@ -27,8 +28,8 @@ public class ConnectorInitializeInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
Connector connector = (Connector) target;
|
||||
agent.getServerInfo().addConnector(connector.getProtocol(), connector.getPort());
|
||||
|
||||
+7
-5
@@ -15,25 +15,27 @@ import com.profiler.context.SpanID;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
import com.profiler.context.TraceID;
|
||||
import com.profiler.interceptor.ApiIdSupport;
|
||||
import com.profiler.interceptor.ByteCodeMethodDescriptorSupport;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.interceptor.TraceContextSupport;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.NumberUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
public class StandardHostValveInvokeInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport, TraceContextSupport {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StandardHostValveInvokeInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
// private int apiId;
|
||||
private TraceContext traceContext;
|
||||
|
||||
@Override
|
||||
public void before(Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
if (isDebug) {
|
||||
logger.fine("before " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -79,8 +81,8 @@ public class StandardHostValveInvokeInterceptor implements StaticAroundIntercept
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
|
||||
traceContext.getActiveThreadCounter().end();
|
||||
|
||||
+5
-3
@@ -1,18 +1,20 @@
|
||||
package com.profiler.modifier.tomcat.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.LifeCycleEventListener;
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class StandardServiceStartInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StandardServiceStartInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private LifeCycleEventListener lifeCycleEventListener;
|
||||
|
||||
@@ -22,8 +24,8 @@ public class StandardServiceStartInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
// if (!InterceptorUtils.isSuccess(result)) {
|
||||
// return;
|
||||
|
||||
+4
-3
@@ -1,11 +1,11 @@
|
||||
package com.profiler.modifier.tomcat.interceptors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.LifeCycleEventListener;
|
||||
import com.profiler.interceptor.StaticAfterInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -14,6 +14,7 @@ import com.profiler.util.StringUtils;
|
||||
public class StandardServiceStopInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
private final Logger logger = Logger.getLogger(StandardServiceStopInterceptor.class.getName());
|
||||
private final boolean isDebug = LoggingUtils.isDebug(logger);
|
||||
|
||||
private LifeCycleEventListener lifeCycleEventListener;
|
||||
|
||||
@@ -23,8 +24,8 @@ public class StandardServiceStopInterceptor implements StaticAfterInterceptor {
|
||||
|
||||
@Override
|
||||
public void after(Object target, String className, String methodName, String parameterDescription, Object[] args, Object result) {
|
||||
if (logger.isLoggable(Level.INFO)) {
|
||||
logger.info("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
if (isDebug) {
|
||||
logger.fine("after " + StringUtils.toString(target) + " " + className + "." + methodName + parameterDescription + " args:" + Arrays.toString(args) + " result:" + result);
|
||||
}
|
||||
// TODO 시작이 실패했을때 stop이 불러 지는가?
|
||||
// if (!InterceptorUtils.isSuccess(result)) {
|
||||
|
||||
Reference in New Issue
Block a user