diff --git a/common/src/main/java/io/netty/util/NetUtil.java b/common/src/main/java/io/netty/util/NetUtil.java index ae4ebb598e..8634351b6a 100644 --- a/common/src/main/java/io/netty/util/NetUtil.java +++ b/common/src/main/java/io/netty/util/NetUtil.java @@ -291,7 +291,10 @@ public final class NetUtil { } } } catch (Exception e) { - logger.debug("Failed to get SOMAXCONN from sysctl and file {}. Default: {}", file, somaxconn, e); + if (logger.isDebugEnabled()) { + logger.debug("Failed to get SOMAXCONN from sysctl and file {}. Default: {}", + file, somaxconn, e); + } } finally { if (in != null) { try { diff --git a/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java b/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java index 26d302e6e4..b05944685b 100644 --- a/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java +++ b/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java @@ -137,9 +137,11 @@ public final class NativeLibraryLoader { return; } catch (Throwable ex) { suppressed.add(ex); - logger.debug( - "{} cannot be loaded from java.library.path, " - + "now trying export to -Dio.netty.native.workdir: {}", name, WORKDIR, ex); + if (logger.isDebugEnabled()) { + logger.debug( + "{} cannot be loaded from java.library.path, " + + "now trying export to -Dio.netty.native.workdir: {}", name, WORKDIR, ex); + } } String libname = System.mapLibraryName(name); diff --git a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java index bc24cc530e..b279abf13d 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java @@ -1163,8 +1163,10 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH return true; } } catch (Throwable cause) { - logger.debug("Unexpected exception while loading class {} classname {}", - getClass(), classname, cause); + if (logger.isDebugEnabled()) { + logger.debug("Unexpected exception while loading class {} classname {}", + getClass(), classname, cause); + } } } } diff --git a/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java b/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java index e78b2337c6..feac4b9145 100644 --- a/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java +++ b/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java @@ -71,7 +71,9 @@ public final class UnixResolverDnsServerAddressStreamProvider implements DnsServ return nameServerCache.mayOverrideNameServers() ? nameServerCache : DefaultDnsServerAddressStreamProvider.INSTANCE; } catch (Exception e) { - logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e); + if (logger.isDebugEnabled()) { + logger.debug("failed to parse {} and/or {}", ETC_RESOLV_CONF_FILE, ETC_RESOLVER_DIR, e); + } return DefaultDnsServerAddressStreamProvider.INSTANCE; } } @@ -254,8 +256,10 @@ public final class UnixResolverDnsServerAddressStreamProvider implements DnsServ DnsServerAddresses existingAddresses = domainToNameServerStreamMap.put(domainName, addresses); if (existingAddresses != null) { domainToNameServerStreamMap.put(domainName, existingAddresses); - logger.debug("Domain name {} already maps to addresses {} so new addresses {} will be discarded", - domainName, existingAddresses, addresses); + if (logger.isDebugEnabled()) { + logger.debug("Domain name {} already maps to addresses {} so new addresses {} will be discarded", + domainName, existingAddresses, addresses); + } } } diff --git a/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java b/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java index dad793cf38..d307508002 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java @@ -173,8 +173,10 @@ final class ChannelHandlerMask { try { m = handlerType.getMethod(methodName, paramTypes); } catch (NoSuchMethodException e) { - logger.debug( - "Class {} missing method {}, assume we can not skip execution", handlerType, methodName, e); + if (logger.isDebugEnabled()) { + logger.debug( + "Class {} missing method {}, assume we can not skip execution", handlerType, methodName, e); + } return false; } return m != null && m.isAnnotationPresent(Skip.class);