Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1708

Allow secure Socket Appender to set socket options

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.8
    • Core
    • None

    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

          Activity

            People

              ggregory Gary D. Gregory
              ggregory Gary D. Gregory
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: