Do not log the deprecated system property when it's not specified by a user

This commit is contained in:
Trustin Lee 2013-12-05 01:39:48 +09:00
parent e88172495a
commit 4f6a591e91

View File

@ -66,11 +66,16 @@ public final class ResourceLeakDetector<T> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ResourceLeakDetector.class); private static final InternalLogger logger = InternalLoggerFactory.getInstance(ResourceLeakDetector.class);
static { static {
final boolean disabled = SystemPropertyUtil.getBoolean("io.netty.noResourceLeakDetection", false); final boolean disabled;
logger.debug("-Dio.netty.noResourceLeakDetection: {}", disabled); if (SystemPropertyUtil.get("io.netty.noResourceLeakDetection") != null) {
logger.warn( disabled = SystemPropertyUtil.getBoolean("io.netty.noResourceLeakDetection", false);
"-Dio.netty.noResourceLeakDetection is deprecated. Use '-D{}={}' instead.", logger.debug("-Dio.netty.noResourceLeakDetection: {}", disabled);
PROP_LEVEL, DEFAULT_LEVEL.name().toLowerCase()); logger.warn(
"-Dio.netty.noResourceLeakDetection is deprecated. Use '-D{}={}' instead.",
PROP_LEVEL, DEFAULT_LEVEL.name().toLowerCase());
} else {
disabled = false;
}
Level defaultLevel = disabled? Level.DISABLED : DEFAULT_LEVEL; Level defaultLevel = disabled? Level.DISABLED : DEFAULT_LEVEL;
String levelStr = SystemPropertyUtil.get(PROP_LEVEL, defaultLevel.name()).trim().toUpperCase(); String levelStr = SystemPropertyUtil.get(PROP_LEVEL, defaultLevel.name()).trim().toUpperCase();
@ -90,7 +95,7 @@ public final class ResourceLeakDetector<T> {
private static final int DEFAULT_SAMPLING_INTERVAL = 113; private static final int DEFAULT_SAMPLING_INTERVAL = 113;
/** /**
* @deprecated Use {@link #setLevel(ResourceLeakDetector.Level)} instead. * @deprecated Use {@link #setLevel(Level)} instead.
*/ */
@Deprecated @Deprecated
public static void setEnabled(boolean enabled) { public static void setEnabled(boolean enabled) {