Description
Allow any secure socket Appender to set socket options.
At the lowest level, this means that if configured the following java.net.Socket options are called:
- java.net.Socket.setKeepAlive(boolean)
- java.net.Socket.setOOBInline(boolean)
- java.net.Socket.setPerformancePreferences(int, int, int)
- java.net.Socket.setReceiveBufferSize(int)
- java.net.Socket.setReuseAddress(boolean)
- java.net.Socket.setSendBufferSize(int)
- java.net.Socket.setSoLinger(boolean, int)
- java.net.Socket.setSoTimeout(int)
- java.net.Socket.setTcpNoDelay(boolean)
- java.net.Socket.setTrafficClass(int)
This will done through a new SocketOptions XML element (same idea for JSON and YAML).
For example:
<Configuration status="OFF" name="MyApp"> <Appenders> <Socket name="socket" host="localhost" port="${sys:SecureSocketAppenderSocketOptionsTest.port}" protocol="SSL" ignoreExceptions="false"> <SocketOptions keepAlive="false" receiveBufferSize="10000" reuseAddress="false" rfc1349TrafficClass="IPTOS_LOWCOST" sendBufferSize="8000" soLinger="12345" soTimeout="54321" tcpNoDelay="false"> <SocketPerformancePreferences bandwidth="100" connectionTime="100" latency="100" /> </SocketOptions> <Ssl> <KeyStore location="src/test/resources/org/apache/logging/log4j/core/net/ssl/client.log4j2-keystore.jks" password="changeit" type="JKS" /> <TrustStore location="src/test/resources/org/apache/logging/log4j/core/net/ssl/truststore.jks" password="changeit" type="JKS" /> </Ssl> </Socket> </Appenders> <Loggers> <Root level="debug"> <AppenderRef ref="socket" /> </Root> </Loggers> </Configuration>
Another ticket will follow for SSL and Syslog.
Attachments
Issue Links
- is a clone of
-
LOG4J2-1707 Allow TCP Socket Appender to set socket options
- Closed
- is related to
-
LOG4J2-1191 Log4j completely hangs in TcpSocketManager after a while...
- Resolved