diff --git a/common/src/main/java/io/netty/util/NetUtil.java b/common/src/main/java/io/netty/util/NetUtil.java index c514ae54bb..91e6f5fc64 100644 --- a/common/src/main/java/io/netty/util/NetUtil.java +++ b/common/src/main/java/io/netty/util/NetUtil.java @@ -289,7 +289,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 6ae062d1a9..8cff331a85 100644 --- a/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java +++ b/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java @@ -138,9 +138,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 a3b4076968..1e8a20e4f7 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java @@ -1167,8 +1167,10 @@ public class SslHandler extends ByteToMessageDecoder { 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 c7856741d9..29d4c3c140 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 @@ -72,7 +72,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; } } @@ -256,8 +258,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 8edc4b703e..7e54b5d4d1 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java @@ -175,8 +175,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);