Skip to content

Commit

Permalink
Merge pull request #694 from bytedance/feat-log
Browse files Browse the repository at this point in the history
remove unused log
  • Loading branch information
yoloyyh authored Oct 11, 2024
2 parents 658beab + a30a24f commit 02d1f9d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ private boolean isBypassHookClass(String className) {
}

public boolean isFunctionEnabled(int classId, int methodId) {
String key = classId + "-" + methodId;
Set<String> types = hookTypes.get(key);


if (switchConfig == null || switchConfig.isEmpty()) {
return true;
}
String key = classId + "-" + methodId;
Set<String> types = hookTypes.get(key);

if (types != null) {
for (String type : types) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ public boolean checkReflectEvil(String classname, String fieldname, boolean isMe

JsRuleResult result = SmithProbeObj.getJsRuleEngine().detect(2, argsX);
if (result != null) {
SmithLogger.logger.info("classname = " + classname + ", fieldname = " + fieldname + ", result = " + result.rulename);
SmithLogger.logger.info("classname = " + classname + ", fieldname = " + fieldname + ", result = " + result.ruleid);
// SmithLogger.logger.info("classname = " + classname + ", fieldname = " + fieldname + ", result = " + result.rulename);
// SmithLogger.logger.info("classname = " + classname + ", fieldname = " + fieldname + ", result = " + result.ruleid);
return true;
}
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static void loggerProberUnInit() {

if (logger != null) {
logger.removeHandler(fileHandler);
logger = null;
}
fileHandler.close();
fileHandler = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public boolean isMatched(Integer ruleId, boolean isWhite) {
needClearStack = true;
formatStack();
}
SmithLogger.logger.info("isWhite: " + isWhite + " ruleId: " + ruleId);
// SmithLogger.logger.info("isWhite: " + isWhite + " ruleId: " + ruleId);

try {
StackRule stackRule = stackRuleMaps.get(ruleId);
Expand All @@ -223,7 +223,7 @@ public boolean isMatched(Integer ruleId, boolean isWhite) {
for (Map.Entry<Long, String> entry : curStack.entrySet()) {
String value = entry.getValue();
if (value.contains(stack.substring(0, stack.length() - 1))) {
SmithLogger.logger.info("find the match, string: " + value + " hashcode: " + entry.getKey());
// SmithLogger.logger.info("find the match, string: " + value + " hashcode: " + entry.getKey());
return true;
}
}
Expand All @@ -234,7 +234,7 @@ public boolean isMatched(Integer ruleId, boolean isWhite) {
} else {
try {
if (curStack.containsKey(item.getHashcode())) {
SmithLogger.logger.info("find the match, string: " + curStack.get(item.getHashcode()) + " hashcode: " + item.getHashcode());
// SmithLogger.logger.info("find the match, string: " + curStack.get(item.getHashcode()) + " hashcode: " + item.getHashcode());
return true;
}
} catch (Exception e) {
Expand All @@ -253,7 +253,7 @@ public boolean isMatched(Integer ruleId, boolean isWhite) {
}
}

SmithLogger.logger.info("not find the match");
// SmithLogger.logger.info("not find the match");
} catch (Exception e) {
SmithLogger.exception(e);
}
Expand All @@ -266,8 +266,8 @@ public void formatStack() {
}
try {
Map<Long, String> cur1Stack = currentStack.get();
SmithLogger.logger.info("curStack size: " + cur1Stack.size());
SmithLogger.logger.info("now to get current stack");
// SmithLogger.logger.info("curStack size: " + cur1Stack.size());
//SmithLogger.logger.info("now to get current stack");
StackTraceElement[] stack_str = Thread.currentThread().getStackTrace();
String[] stackTraceStrings = new String[stack_str.length];
Map<Long, String> curStack = new HashMap<>();
Expand All @@ -293,9 +293,9 @@ public void clearStack() {
}
try {
Map<Long, String> curStack = currentStack.get();
SmithLogger.logger.info("curStack size: " + curStack.size());
//SmithLogger.logger.info("curStack size: " + curStack.size());
curStack.clear();
SmithLogger.logger.info("clear currentStack");
//SmithLogger.logger.info("clear currentStack");
} catch (Exception e) {
SmithLogger.exception(e);
}
Expand Down

0 comments on commit 02d1f9d

Please sign in to comment.