Log4j 2
  1. Log4j 2
  2. LOG4J2-120

Socket/Syslog appenders throw IOException if destination socket is not open

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta2
    • Fix Version/s: 2.0-beta4
    • Component/s: Appenders
    • Labels:
      None
    • Environment:

      Java 1.6.0_24

      Description

      If Log4J2 is initialized with a configured Socket or Syslog appender, and the destination socket is not open, a IOException is thrown within TCPSocketManagerFactory on the "new Socket(data.host, data.port)" line.

      This exception results in either a NullPointerException thrown to the calling code, regardless if if suppressExceptions is true or false. No reconnect attempt is made, regardless if reconnectionDelay is set to a positive number.

      The socket can still be created by TCPSocketManagerFactory, but attempting to connect to the socket should wait until the first logging statement so that reconnection retries may be used.

      1. log4j2.xml
        0.4 kB
        Scott Severtson
      2. TestConnectBehavior.java
        0.7 kB
        Scott Severtson

        Activity

        Scott Severtson made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Scott Severtson added a comment -

        Beta 3 appears to resolve this issue. Thanks!

        Show
        Scott Severtson added a comment - Beta 3 appears to resolve this issue. Thanks!
        Ralph Goers made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
        Fix Version/s 2.0-beta4 [ 12323477 ]
        Resolution Fixed [ 1 ]
        Hide
        Ralph Goers added a comment -

        Fixed in revision 1411311. Please verify and close.

        Show
        Ralph Goers added a comment - Fixed in revision 1411311. Please verify and close.
        Scott Severtson made changes -
        Attachment TestConnectBehavior.java [ 12553681 ]
        Hide
        Scott Severtson added a comment -

        Demonstration app to show the problem. Assumes port 5514 is not opened by another application.

        Show
        Scott Severtson added a comment - Demonstration app to show the problem. Assumes port 5514 is not opened by another application.
        Scott Severtson made changes -
        Field Original Value New Value
        Attachment log4j2.xml [ 12553679 ]
        Hide
        Scott Severtson added a comment -

        Sample log4j2.xml configuration file to demonstrate the problem.

        Show
        Scott Severtson added a comment - Sample log4j2.xml configuration file to demonstrate the problem.
        Scott Severtson created issue -

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Scott Severtson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development