mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-25 04:35:59 +10:00
[강운덕] [LUCYSUS-1744] logger 쪽 before, after appender 메모리 사용량이 적게 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1538 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -8,6 +8,8 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class ClassLoadChecker {
|
||||
private final Logger logger = LoggerFactory.getLogger(ClassLoadChecker.class.getName());
|
||||
private final boolean isDebug = logger.isDebugEnabled();
|
||||
|
||||
private static final Object EXIST = new Object();
|
||||
|
||||
private ConcurrentMap<LoadClass, Object> load = new ConcurrentHashMap<LoadClass, Object>();
|
||||
@@ -16,13 +18,13 @@ public class ClassLoadChecker {
|
||||
LoadClass key = new LoadClass(cl, className);
|
||||
Object old = load.putIfAbsent(key, EXIST);
|
||||
if (old == null) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("{} not exist from ", cl);
|
||||
if (isDebug) {
|
||||
logger.debug("{} not exist from ", cl);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("{} already exist from ", cl);
|
||||
if (isDebug) {
|
||||
logger.debug("{} already exist from ", cl);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,28 @@ public class Slf4jLoggerAdapter implements Logger {
|
||||
sb.append(methodName);
|
||||
sb.append(parameterDescription);
|
||||
sb.append(" args:");
|
||||
sb.append(Arrays.toString(args));
|
||||
appendArray(sb, args);
|
||||
}
|
||||
|
||||
private static void appendArray(StringBuilder sb, Object[] args) {
|
||||
if (args == null) {
|
||||
sb.append("null");
|
||||
return;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length > 0) {
|
||||
sb.append('(');
|
||||
sb.append(args[0]);
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
sb.append(", ");
|
||||
sb.append(args[i]);
|
||||
}
|
||||
sb.append(')');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user