kaushiksrinivas opened a new issue, #4309: URL: https://github.com/apache/logging-log4j2/issues/4309
Description Log4j2 SyslogAppender (and Socket) validates host with @ValidHost → InetAddress.getByName once at plugin build. If the name is syntactically fine but not in DNS yet (typical Kubernetes: collector Service created after the app JVM starts), configuration fail-closes: java.net.UnknownHostException The hostname is invalid field 'host' has invalid value '…' Null object returned for Syslog Unable to locate appender "SYSLOG" reconnectionDelayMillis, immediateFail, ignoreExceptions, and AsyncAppender do not help: there is no appender. monitorInterval only reloads if the config file mtime changes; it does not retry DNS by itself. This matches [LOG4J2-1047](https://issues.apache.org/jira/browse/LOG4J2-1047) (2015, still Open): When SyslogAppender can't find inetAddress at startup, it will never try to reconnect. Current 2.x surfaces the failure at @ValidHost ([LOG4J2-1755](https://issues.apache.org/jira/browse/LOG4J2-1755) introduced that constraint; it is not a separate product bug). Ask: do not use live DNS as “is this a valid host.” Reject empty/garbage host; on UnknownHostException, still create the appender and resolve on connect/reconnect (same idea as the 1047 patch). Steps to reproduce Log4j2 config with Syslog host = a DNS name that does not resolve, protocol=TCP, optional reconnectionDelayMillis=5000. Start the JVM. Confirm the errors above; root logger has no SYSLOG. Publish the DNS name (e.g. create the Kubernetes Service). Do not restart, do not change/touch the config file. Keep logging. Actual SYSLOG never appears for that process. After DNS works, InetAddress.getByName would succeed, but Log4j2 never calls it again. Expected After DNS exists, Syslog connects (or retries) without a process restart or a forced config-file reload. A typo in host can still fail fast. Environment Log4j2 2.x Kubernetes: host = *.svc.cluster.local not present at JVM start, present seconds/minutes later -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
