From 021ecd45c337d718e5deaa65ad81269d2c90ee44 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 4 Aug 2014 10:25:11 -0700 Subject: [PATCH] More brief somaxconn logging - Consistent log message format - Avoid unnecessary autoboxing when debug level is off - Remove the duplication of somaxconn path --- common/src/main/java/io/netty/util/NetUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/io/netty/util/NetUtil.java b/common/src/main/java/io/netty/util/NetUtil.java index 2afe52e9f3..0dcba4e28b 100644 --- a/common/src/main/java/io/netty/util/NetUtil.java +++ b/common/src/main/java/io/netty/util/NetUtil.java @@ -187,9 +187,11 @@ public final class NetUtil { try { in = new BufferedReader(new FileReader(file)); somaxconn = Integer.parseInt(in.readLine()); - logger.debug("/proc/sys/net/core/somaxconn: {}", somaxconn); + if (logger.isDebugEnabled()) { + logger.debug("{}: {}", file, somaxconn); + } } catch (Exception e) { - logger.debug("Failed to get SOMAXCONN", e); + logger.debug("Failed to get SOMAXCONN from: {}", file, e); } finally { if (in != null) { try { @@ -200,7 +202,9 @@ public final class NetUtil { } } } else { - logger.debug("/proc/sys/net/core/somaxconn not exists. Use default-value: {}", somaxconn); + if (logger.isDebugEnabled()) { + logger.debug("{}: {} (non-existent)", file, somaxconn); + } } SOMAXCONN = somaxconn;