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

Allow TCP Socket Appender to set socket options

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8
    • Component/s: Core
    • Labels:
      None

      Description

      Allow any TCP 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).

      Configuration example:

      <Configuration status="OFF" name="MyApp">
        <Appenders>
          <Socket name="socket" host="localhost" port="${sys:SocketAppenderSocketOptionsTest.port}" protocol="TCP" ignoreExceptions="false">
            <SocketOptions keepAlive="false" oobInline="false" receiveBufferSize="10000" reuseAddress="false"
              rfc1349TrafficClass="IPTOS_LOWCOST" sendBufferSize="8000" soLinger="12345" soTimeout="54321" tcpNoDelay="false">
              <SocketPerformancePreferences bandwidth="100" connectionTime="100" latency="100" />
            </SocketOptions>
          </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

              • Assignee:
                garydgregory Gary Gregory
                Reporter:
                garydgregory Gary Gregory
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: