Less confusing log messages for system properties

- Fixes #1502
This commit is contained in:
Trustin Lee 2013-07-02 09:23:29 +09:00
parent 43da224978
commit 4b11aff08f
6 changed files with 23 additions and 16 deletions

View File

@ -77,19 +77,19 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator {
PlatformDependent.maxDirectMemory() / defaultChunkSize / 2 / 3)));
if (logger.isDebugEnabled()) {
logger.debug("io.netty.allocator.numHeapArenas: {}", DEFAULT_NUM_HEAP_ARENA);
logger.debug("io.netty.allocator.numDirectArenas: {}", DEFAULT_NUM_DIRECT_ARENA);
logger.debug("-Dio.netty.allocator.numHeapArenas: {}", DEFAULT_NUM_HEAP_ARENA);
logger.debug("-Dio.netty.allocator.numDirectArenas: {}", DEFAULT_NUM_DIRECT_ARENA);
if (pageSizeFallbackCause == null) {
logger.debug("io.netty.allocator.pageSize: {}", DEFAULT_PAGE_SIZE);
logger.debug("-Dio.netty.allocator.pageSize: {}", DEFAULT_PAGE_SIZE);
} else {
logger.debug("io.netty.allocator.pageSize: {}", DEFAULT_PAGE_SIZE, pageSizeFallbackCause);
logger.debug("-Dio.netty.allocator.pageSize: {}", DEFAULT_PAGE_SIZE, pageSizeFallbackCause);
}
if (maxOrderFallbackCause == null) {
logger.debug("io.netty.allocator.maxOrder: {}", DEFAULT_MAX_ORDER);
logger.debug("-Dio.netty.allocator.maxOrder: {}", DEFAULT_MAX_ORDER);
} else {
logger.debug("io.netty.allocator.maxOrder: {}", DEFAULT_MAX_ORDER, maxOrderFallbackCause);
logger.debug("-Dio.netty.allocator.maxOrder: {}", DEFAULT_MAX_ORDER, maxOrderFallbackCause);
}
logger.debug("io.netty.allocator.chunkSize: {}", DEFAULT_PAGE_SIZE << DEFAULT_MAX_ORDER);
logger.debug("-Dio.netty.allocator.chunkSize: {}", DEFAULT_PAGE_SIZE << DEFAULT_MAX_ORDER);
}
}

View File

@ -35,7 +35,7 @@ public final class ResourceLeakDetector<T> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ResourceLeakDetector.class);
static {
logger.debug("io.netty.noResourceLeakDetection: {}", DISABLED);
logger.debug("-Dio.netty.noResourceLeakDetection: {}", DISABLED);
}
private static final int DEFAULT_SAMPLING_INTERVAL = 113;

View File

@ -73,7 +73,7 @@ public final class PlatformDependent {
static {
if (logger.isDebugEnabled()) {
logger.debug("io.netty.noPreferDirect: {}", !DIRECT_BUFFER_PREFERRED);
logger.debug("-Dio.netty.noPreferDirect: {}", !DIRECT_BUFFER_PREFERRED);
}
if (!hasUnsafe()) {
@ -446,12 +446,14 @@ public final class PlatformDependent {
}
private static boolean hasUnsafe0() {
boolean noUnsafe = SystemPropertyUtil.getBoolean("io.netty.noUnsafe", false);
logger.debug("-Dio.netty.noUnsafe: {}", noUnsafe);
if (isAndroid()) {
logger.debug("sun.misc.Unsafe: unavailable (Android)");
return false;
}
boolean noUnsafe = SystemPropertyUtil.getBoolean("io.netty.noUnsafe", false);
if (noUnsafe) {
logger.debug("sun.misc.Unsafe: unavailable (io.netty.noUnsafe)");
return false;
@ -550,6 +552,8 @@ public final class PlatformDependent {
private static boolean hasJavassist0() {
boolean noJavassist = SystemPropertyUtil.getBoolean("io.netty.noJavassist", false);
logger.debug("-Dio.netty.noJavassist: {}", noJavassist);
if (noJavassist) {
logger.debug("Javassist: unavailable (io.netty.noJavassist)");
return false;

View File

@ -20,16 +20,14 @@ import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOption;
import io.netty.testsuite.util.TestUtils;
import io.netty.util.internal.SystemPropertyUtil;
import org.junit.Assert;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.junit.Assume;
import org.junit.Test;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.net.NoRouteToHostException;
import java.net.Socket;
import static org.hamcrest.CoreMatchers.*;
@ -39,6 +37,11 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
private static final String BAD_HOST = SystemPropertyUtil.get("io.netty.testsuite.badHost", "255.255.255.0");
static {
InternalLoggerFactory.getInstance(SocketConnectionAttemptTest.class).debug(
"-Dio.netty.testsuite.badHost: {}", BAD_HOST);
}
@Test(timeout = 30000)
public void testConnectTimeout() throws Throwable {
run();

View File

@ -38,7 +38,7 @@ public abstract class MultithreadEventLoopGroup extends MultithreadEventExecutor
"io.netty.eventLoopThreads", Runtime.getRuntime().availableProcessors() * 2));
if (logger.isDebugEnabled()) {
logger.debug("io.netty.eventLoopThreads: {}", DEFAULT_EVENT_LOOP_THREADS);
logger.debug("-Dio.netty.eventLoopThreads: {}", DEFAULT_EVENT_LOOP_THREADS);
}
}

View File

@ -84,8 +84,8 @@ public final class NioEventLoop extends SingleThreadEventLoop {
SELECTOR_AUTO_REBUILD_THRESHOLD = selectorAutoRebuildThreshold;
if (logger.isDebugEnabled()) {
logger.debug("io.netty.noKeySetOptimization: {}", DISABLE_KEYSET_OPTIMIZATION);
logger.debug("io.netty.selectorAutoRebuildThreshold: {}", SELECTOR_AUTO_REBUILD_THRESHOLD);
logger.debug("-Dio.netty.noKeySetOptimization: {}", DISABLE_KEYSET_OPTIMIZATION);
logger.debug("-Dio.netty.selectorAutoRebuildThreshold: {}", SELECTOR_AUTO_REBUILD_THRESHOLD);
}
}