Skip to content

Commit d539769

Browse files
original-brownbeartlrx
authored andcommitted
Add Logging to Mock Repo API Server (#49409)
While we log exception in the handler, we may still miss exceptions hgiher up the execution chain. This adds logging of exceptions to all operations on the IO loop including connection establishment. Relates #49401
1 parent 17e0a42 commit d539769

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/framework/src/main/java/org/elasticsearch/repositories/blobstore/ESMockAPIBasedRepositoryIntegTestCase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.sun.net.httpserver.HttpHandler;
2323
import com.sun.net.httpserver.HttpServer;
2424
import org.apache.http.HttpStatus;
25+
import org.apache.logging.log4j.LogManager;
2526
import org.apache.logging.log4j.Logger;
2627
import org.apache.logging.log4j.message.ParameterizedMessage;
2728
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
@@ -72,9 +73,19 @@ protected interface BlobStoreHttpHandler extends HttpHandler {
7273
private static HttpServer httpServer;
7374
private Map<String, HttpHandler> handlers;
7475

76+
private static final Logger log = LogManager.getLogger();
77+
7578
@BeforeClass
7679
public static void startHttpServer() throws Exception {
7780
httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
81+
httpServer.setExecutor(r -> {
82+
try {
83+
r.run();
84+
} catch (Throwable t) {
85+
log.error("Error in execution on mock http server IO thread", t);
86+
throw t;
87+
}
88+
});
7889
httpServer.start();
7990
}
8091

0 commit comments

Comments
 (0)