Skip to content

Commit

Permalink
日志整理
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchenxu committed Jan 6, 2019
1 parent 1e73ca9 commit da302e3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void reTransformClasses(final int watchId,
}

if (logger.isDebugEnabled()) {
logger.debug("reTransformClasses:{};module[id:{}];watch[Id:{}];",
logger.debug("reTransformClasses={};module={};watch={};",
waitingReTransformClasses, coreModule.getUniqueId(), watchId);
}

Expand All @@ -105,11 +105,11 @@ private void reTransformClasses(final int watchId,
if (null == progress) {
try {
inst.retransformClasses(waitingReTransformClasses.toArray(new Class[0]));
logger.info("module[id:{}] watch[id:{}] batch reTransform classes[count:{}] success.",
coreModule.getUniqueId(), watchId, waitingReTransformClasses.size());
logger.info("watch={} in module={} batch reTransform {} classes success.",
watchId, coreModule.getUniqueId(), waitingReTransformClasses.size());
} catch (Throwable e) {
logger.warn("module[id:{}] watch[id:{}] batch reTransform classes[count:{}] failed.",
coreModule.getUniqueId(), watchId, waitingReTransformClasses.size(), e);
logger.warn("watch={} in module={} batch reTransform {} classes failed.",
watchId, coreModule.getUniqueId(), waitingReTransformClasses.size(), e);
batchReTransformSuccess = false;
}
}
Expand All @@ -129,30 +129,30 @@ private void reTransformClasses(final int watchId,
} catch (Throwable cause) {
// 在进行进度汇报的过程中抛出异常,直接进行忽略,因为不影响形变的主体流程
// 仅仅只是一个汇报作用而已
logger.warn("module[id:{}] watch[id:{}] on class:{} report progressOnSuccess occur exception at index:{},total:{},class:{};",
coreModule.getUniqueId(), watchId, waitingReTransformClass,
logger.warn("watch={} in module={} on {} report progressOnSuccess occur exception at index={};total={};",
watchId, coreModule.getUniqueId(), waitingReTransformClass,
index - 1, total,
cause
);
}
}
inst.retransformClasses(waitingReTransformClass);
logger.info("module[id:{}] watch[id:{}] single reTransform class:{} success, at index:{},total:{};",
coreModule.getUniqueId(), watchId, waitingReTransformClass,
logger.info("watch={} in module={} single reTransform {} success, at index={};total={};",
watchId, coreModule.getUniqueId(), waitingReTransformClass,
index - 1, total
);
} catch (Throwable causeOfReTransform) {
logger.warn("module[id:{}] watch[id:{}] single reTransform class:{} failed, at index:{},total:{}. ignore this class.",
coreModule.getUniqueId(), watchId, waitingReTransformClass,
logger.warn("watch={} in module={} single reTransform {} failed, at index={};total={}. ignore this class.",
watchId, coreModule.getUniqueId(), waitingReTransformClass,
index - 1, total,
causeOfReTransform
);
if (null != progress) {
try {
progress.progressOnFailed(waitingReTransformClass, index, causeOfReTransform);
} catch (Throwable cause) {
logger.warn("module[id:{}] watch[id:{}] on class:{} report progressOnFailed occur exception, at index:{},total:{};",
coreModule.getUniqueId(), watchId, waitingReTransformClass,
logger.warn("watch={} in module={} on {} report progressOnFailed occur exception, at index={};total={};",
watchId, coreModule.getUniqueId(), waitingReTransformClass,
index - 1, total,
cause
);
Expand Down Expand Up @@ -205,8 +205,11 @@ private int watch(final Matcher matcher,

// 查找需要渲染的类集合
final List<Class<?>> waitingReTransformClasses = classDataSource.findForReTransform(matcher);
logger.info("{} watch[id:{}] found classes:{} in loaded for watch(ing).",
coreModule, watchId, waitingReTransformClasses.size());
logger.info("watch={} in module={} found {} classes for watch(ing).",
watchId,
coreModule.getUniqueId(),
waitingReTransformClasses.size()
);

int cCnt = 0, mCnt = 0;

Expand Down Expand Up @@ -273,8 +276,11 @@ public void delete(final int watcherId,
final List<Class<?>> waitingReTransformClasses = classDataSource.findForReTransform(
new GroupMatcher.Or(waitingRemoveMatcherSet.toArray(new Matcher[0]))
);
logger.info("{} found classes:{} in loaded for delete.",
coreModule, waitingReTransformClasses.size());
logger.info("watch={} in module={} found {} classes for delete.",
watcherId,
coreModule.getUniqueId(),
waitingReTransformClasses.size()
);

beginProgress(progress, waitingReTransformClasses.size());
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

/**
* 沙箱类形变器
* Created by luanjia@taobao.com on 2016/11/14.
*
* @author luanjia@taobao.com
*/
public class SandboxClassFileTransformer implements ClassFileTransformer {

Expand Down Expand Up @@ -96,9 +97,11 @@ public byte[] transform(final ClassLoader loader,


} catch (Throwable cause) {
logger.warn("sandbox transform class:{} in loader:{};namespace:{} failed, module[id:{}] at watch[id:{}] will ignore this transform.",
internalClassName, loader, namespace,
uniqueId, watchId,
logger.warn("sandbox transform {} in loader={}; failed, module={} at watch={}, will ignore this transform.",
internalClassName,
loader,
uniqueId,
watchId,
cause
);
return null;
Expand All @@ -112,7 +115,7 @@ private byte[] _transform(final ClassLoader loader,
// 如果未开启unsafe开关,是不允许增强来自BootStrapClassLoader的类
if (!isEnableUnsafe
&& null == loader) {
logger.debug("transform ignore class:{}, class from bootstrap but unsafe.enable:false.", internalClassName);
logger.debug("transform ignore {}, class from bootstrap but unsafe.enable=false.", internalClassName);
return null;
}

Expand All @@ -122,7 +125,7 @@ private byte[] _transform(final ClassLoader loader,

// 如果一个行为都没匹配上也不用继续了
if (!matchingResult.isMatched()) {
logger.debug("transform ignore class:{}, no behaviors matched in loader:{};namespace:{}", internalClassName, loader, namespace);
logger.debug("transform ignore {}, no behaviors matched in loader={}", internalClassName, loader);
return null;
}

Expand All @@ -137,17 +140,17 @@ private byte[] _transform(final ClassLoader loader,
eventTypeArray
);
if (srcByteCodeArray == toByteCodeArray) {
logger.debug("transform ignore class:{}, nothing changed in loader:{}. namespace:{}", internalClassName, loader, namespace);
logger.debug("transform ignore {}, nothing changed in loader={}", internalClassName, loader);
return null;
}

// statistic affect
affectStatistic.statisticAffect(loader, internalClassName, behaviorSignCodes);

logger.info("transform class:{} finished, by module[id:{}] in loader:{};namespace:{}", internalClassName, uniqueId, loader, namespace);
logger.info("transform {} finished, by module={} in loader={}", internalClassName, uniqueId, loader);
return toByteCodeArray;
} catch (Throwable cause) {
logger.warn("transform class:{} failed, by module[id={}] in loader:{}namespace:{};", internalClassName, uniqueId, loader, namespace, cause);
logger.warn("transform {} failed, by module={} in loader={}", internalClassName, uniqueId, loader, cause);
return null;
}
}
Expand Down

0 comments on commit da302e3

Please sign in to comment.