More brief somaxconn logging

- Consistent log message format
- Avoid unnecessary autoboxing when debug level is off
- Remove the duplication of somaxconn path
This commit is contained in:
Trustin Lee 2014-08-04 10:25:11 -07:00
parent 20dffa8ee6
commit a5ccec5ef3

View File

@ -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;