Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// Project settings
group = "org.veupathdb.lib"
version = "7.0.6"
version = "7.0.7"

plugins {
`java-library`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import jakarta.ws.rs.ext.Provider;
import org.apache.logging.log4j.Logger;
import org.glassfish.grizzly.http.server.Request;
import org.veupathdb.lib.container.jaxrs.Globals;
import org.veupathdb.lib.container.jaxrs.providers.LogProvider;
import org.veupathdb.lib.container.jaxrs.utils.RequestKeys;
import org.veupathdb.lib.container.jaxrs.utils.logging.LoggingVars;
import org.veupathdb.lib.container.jaxrs.view.error.*;

import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
Expand Down Expand Up @@ -65,7 +67,10 @@ public Response toResponse(Throwable err) {
: INTERNAL_SERVER_ERROR.getStatusCode();

if (code == INTERNAL_SERVER_ERROR.getStatusCode()) {
log.error("Caught Exception: ", err);
// Log the trace-id, since it's being removed from the ThreadContext before this point.
// It's unclear why it's being removed from the context before this is invoked, but this ensures we have it.
String traceId = _request.get().getHeader(Globals.TRACE_ID_HEADER);
log.error("(trace: {}) Caught Exception: ", traceId, err);

// If final response is 5XX, emit a metric.
INTERNAL_ERROR_COUNT.inc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void filter(ContainerRequestContext req, ContainerResponseContext res) {
}

private void removeContext() {
LOG.debug("Removing logging variables from thread context.");
ThreadContext.remove(Globals.CONTEXT_ID);
LoggingVars.clear();
}
Expand Down