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

TcpSocketManager.write swallows IOException when retry = false or reconnector != null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.12.1
    • 2.15.0
    • Appenders
    • None

    Description

      Hi, I see very stange behavior when using tcp SocketAppender. My configuration is:

      <Socket name="auditSocket" protocol="TCP" host="10.8.84.194" port="4587" connectTimeoutMillis="10000" reconnectionDelayMillis="10000"
      immediateFail="true" immediateFlush="true" ignoreExceptions="false" bufferedIO="false">

      After application starts and before writing any logs I simulate connection reset with:

      iptables -A OUTPUT -p tcp -d 10.8.84.194 --dport 4587 -j REJECT --reject-with tcp-reset

      Now the strange part:

      1. First log is written to output stream successfully (but nothing actually gets sent)
      2. Second log throws IOException on outputstream write, this gets handled with a reconnection attempt (which fails) and result is AppenderLoggingException - this is what I expect because I'm using a failover appender to route the log into file.
      3. Third and subsequent log attempts also fail due to IOException on outputstream write BUT no AppenderLoggingException is raised - reconnector is not null at this point and IOException gets swallowed up.

       

      I'm using log4j2 2.12.1

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              okanarbik Mihail
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: