From dde894310d31c51b0aebd3c6a1ac6e4d36be6b46 Mon Sep 17 00:00:00 2001 From: Matteo Merli Date: Mon, 31 Aug 2015 15:06:35 -0700 Subject: [PATCH] Added debug logging with effective value for io.netty.leakDetection.acquireAndReleaseOnly property Motivation: The configurable property value recently added was not logged like others properties. Modifications: Added debug log with effective value applied. Result: Consistent with other properties --- .../java/io/netty/buffer/AdvancedLeakAwareByteBuf.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buffer/src/main/java/io/netty/buffer/AdvancedLeakAwareByteBuf.java b/buffer/src/main/java/io/netty/buffer/AdvancedLeakAwareByteBuf.java index 62b2b774b3..7f32669fa8 100644 --- a/buffer/src/main/java/io/netty/buffer/AdvancedLeakAwareByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/AdvancedLeakAwareByteBuf.java @@ -19,6 +19,8 @@ package io.netty.buffer; import io.netty.util.ByteProcessor; import io.netty.util.ResourceLeak; import io.netty.util.internal.SystemPropertyUtil; +import io.netty.util.internal.logging.InternalLogger; +import io.netty.util.internal.logging.InternalLoggerFactory; import java.io.IOException; import java.io.InputStream; @@ -34,8 +36,14 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf { private static final String PROP_ACQUIRE_AND_RELEASE_ONLY = "io.netty.leakDetection.acquireAndReleaseOnly"; private static final boolean ACQUIRE_AND_RELEASE_ONLY; + private static final InternalLogger logger = InternalLoggerFactory.getInstance(AdvancedLeakAwareByteBuf.class); + static { ACQUIRE_AND_RELEASE_ONLY = SystemPropertyUtil.getBoolean(PROP_ACQUIRE_AND_RELEASE_ONLY, false); + + if (logger.isDebugEnabled()) { + logger.debug("-D{}: {}", PROP_ACQUIRE_AND_RELEASE_ONLY, ACQUIRE_AND_RELEASE_ONLY); + } } private final ResourceLeak leak;