vindeckyy opened a new pull request, #4462:
URL: https://github.com/apache/logging-log4j2/pull/4462

   Fixes #4309.
   
   `@ValidHost` and `TcpSocketManagerFactory` both treat a host that does not 
resolve *now* as invalid, so the appender is discarded at configuration time. A 
host that only appears in DNS later (a Kubernetes Service created after the JVM 
starts) never recovers without a restart, and `reconnectionDelayMillis` cannot 
help because no appender or manager is left.
   
   ## Changes
   
   - `ValidHostValidator` still rejects null, empty, malformed names and 
out-of-range IPv4 literals, but accepts a syntactically valid host name that 
does not resolve yet and logs a warning. The name is resolved when connecting.
   - `TcpSocketManagerFactory` no longer returns `null` on 
`UnknownHostException` when a reconnection delay is configured; it creates a 
manager with no socket and lets the existing `Reconnector` resolve the host on 
every attempt. Appenders always get a delay (`getSocketManager` defaults it to 
30s), so this also covers default configurations.
   - `DatagramSocketManager`/`DatagramOutputStream` resolve the host on the 
first datagram instead of failing construction, and retry while the host stays 
unresolved.
   - `AbstractSocketManager#getContentFormat` falls back to the host name while 
no address is known.
   - Updated the `@ValidHost` Javadoc and the plugin manual.
   
   ## Tests
   
   
`SocketAppenderReconnectTest#unresolvable_host_should_be_resolved_on_reconnect` 
fails before the change (`appender dropped for an unresolvable host`) and 
passes after it. `ValidHostValidatorTest` covers the accepted and rejected 
names, and `DatagramOutputStreamTest` covers the UDP retry path.
   
   Targeted run: 82 tests in `SocketAppender*Test`, `SyslogAppender*Test`, 
`Tls*Test`, `SslSocketManagerTest`, `ValidHostValidatorTest`, 
`DatagramOutputStreamTest`, 0 failures. `spotless:check` passes.
   


-- 
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]

Reply via email to