|
46 | 46 | import org.apache.logging.log4j.core.net.TcpSocketManager; |
47 | 47 | import org.apache.logging.log4j.core.net.TcpSocketManager.HostResolver; |
48 | 48 | import org.apache.logging.log4j.core.net.ssl.SslKeyStoreConstants; |
| 49 | +import org.apache.logging.log4j.status.StatusLogger; |
49 | 50 | import org.apache.logging.log4j.test.junit.UsingStatusListener; |
50 | 51 | import org.junit.jupiter.api.Test; |
51 | 52 | import org.junit.jupiter.api.io.CleanupMode; |
|
56 | 57 | */ |
57 | 58 | public class SocketAppenderReconnectTest { |
58 | 59 |
|
| 60 | + private static final String CLASS_NAME = SocketAppenderReconnectTest.class.getSimpleName(); |
| 61 | + |
59 | 62 | private static final int EPHEMERAL_PORT = 0; |
60 | 63 |
|
61 | 64 | private static final String APPENDER_NAME = "TestSocket"; |
@@ -340,6 +343,9 @@ private static void verifyLoggingSuccess( |
340 | 343 | final BufferingErrorHandler errorHandler) |
341 | 344 | throws Exception { |
342 | 345 |
|
| 346 | + // Report status |
| 347 | + StatusLogger.getLogger().trace("[{}] verifying logging success", CLASS_NAME); |
| 348 | + |
343 | 349 | // Create messages to log |
344 | 350 | final int messageCount = 2; |
345 | 351 | assertThat(messageCount) |
@@ -380,11 +386,18 @@ private static void verifyLoggingSuccess( |
380 | 386 |
|
381 | 387 | private static void verifyLoggingFailure( |
382 | 388 | final LoggerContext loggerContext, final BufferingErrorHandler errorHandler) { |
| 389 | + |
| 390 | + // Report status |
| 391 | + StatusLogger.getLogger().trace("[{}] verifying logging failure", CLASS_NAME); |
| 392 | + |
| 393 | + // Verify the configuration |
383 | 394 | final Logger logger = loggerContext.getRootLogger(); |
384 | 395 | final int retryCount = 3; |
385 | 396 | assertThat(retryCount) |
386 | 397 | .as("expecting `retryCount > 1` due to LOG4J2-2829") |
387 | 398 | .isGreaterThan(1); |
| 399 | + |
| 400 | + // Verify the failure |
388 | 401 | for (int i = 0; i < retryCount; i++) { |
389 | 402 | try { |
390 | 403 | logger.info("should fail #" + i); |
|
0 commit comments