Log harmless exception in DEBUG level (#4156)

* Log harmless exception in DEBUG level

* Log harmless exception in DEBUG level

* Minor refactor to avoid default method
This commit is contained in:
kezhenxu94 2020-01-01 09:13:55 +08:00 committed by GitHub
parent d38a8eaaa7
commit 9862fe023f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 2 deletions

View File

@ -51,5 +51,7 @@ public interface ILog {
void debug(String format, Object... arguments);
void debug(Throwable t, String format, Object... arguments);
void error(String format);
}

View File

@ -78,6 +78,11 @@ public enum NoopLogger implements ILog {
}
@Override
public void debug(final Throwable t, final String format, final Object... arguments) {
}
@Override
public void error(String format) {

View File

@ -184,6 +184,12 @@ public class PatternLogger implements ILog {
}
}
@Override
public void debug(final Throwable t, final String format, final Object... arguments) {
if (isDebugEnable()) {
logger(LogLevel.DEBUG, replaceParam(format, arguments), t);
}
}
String format(LogLevel level, String message, Throwable t) {
LogEvent logEvent = new LogEvent(level, message, t, targetClass);

View File

@ -46,7 +46,9 @@ public class ProtectiveShieldMatcher<T> extends ElementMatcher.Junction.Abstract
try {
return this.matcher.matches(target);
} catch (Throwable t) {
logger.warn(t, "Byte-buddy occurs exception when match type.");
if (logger.isDebugEnable()) {
logger.debug(t, "Byte-buddy occurs exception when match type.");
}
return false;
}
}

View File

@ -48,7 +48,7 @@ collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
logging.file_name=${SW_LOGGING_FILE_NAME:skywalking-api.log}
# Logging level
logging.level=${SW_LOGGING_LEVEL:DEBUG}
logging.level=${SW_LOGGING_LEVEL:INFO}
# Logging dir
# logging.dir=${SW_LOGGING_DIR:""}