Description
SocketAppender crashes log4j with StackOverflowException when the server where the log file should be sent is not accessible. It looks like toString() contains recursion.
This also happens in 2.11.2 (even though log shows 2.11.0).
This does not happen in 2.8.2 ( toString() methods were not there in that version)
java.lang.StackOverflowError: null at java.lang.Integer.toUnsignedString0(Integer.java:344) ~[?:?] at java.lang.Integer.toHexString(Integer.java:262) ~[?:?] at java.lang.Object.toString(Object.java:246) ~[?:?] at java.util.concurrent.CountDownLatch.toString(CountDownLatch.java:314) ~[?:?] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at ... 1000s of same messages repeated in between ... org.apache.logging.log4j.core.net.TcpSocketManager$Reconnector.toString(TcpSocketManager.java:358) ~[log4j-core-2.11.0.jar:2.11.0] at java.lang.String.valueOf(String.java:2951) ~[?:?] at java.lang.StringBuilder.append(StringBuilder.java:168) ~[?:?] at org.apache.logging.log4j.core.net.TcpSocketManager.toString(TcpSocketManager.java:495) ~[log4j-core-2.11.0.jar:2.11.0]