Skip to content

Commit 10dd890

Browse files
committed
Log participant name
1 parent 2762f9f commit 10dd890

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/main/java/com/uid2/core/handler/GenericFailureHandler.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.uid2.core.handler;
22

3+
import com.uid2.shared.auth.IAuthorizable;
4+
import com.uid2.shared.auth.OperatorKey;
5+
import com.uid2.shared.middleware.AuthMiddleware;
36
import io.vertx.core.Handler;
47
import io.vertx.core.http.HttpClosedException;
58
import io.vertx.core.http.HttpServerResponse;
@@ -19,11 +22,18 @@ public void handle(RoutingContext ctx) {
1922
String url = ctx.normalizedPath();
2023
Throwable t = ctx.failure();
2124

25+
final IAuthorizable profile = AuthMiddleware.getAuthClient(ctx);
26+
final OperatorKey operatorKey = profile instanceof OperatorKey ? (OperatorKey) profile : null;
27+
String participant = "unknown";
28+
if (operatorKey != null) {
29+
participant = operatorKey.getName();
30+
}
31+
2232
if (t != null) {
2333
if (statusCode >= 500 && statusCode < 600) { // 5xx is server error, so error
24-
LOGGER.error("URL: [{}] - Error response code: [{}] - Error:", url, statusCode, t);
34+
LOGGER.error("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t);
2535
} else if (statusCode >= 400 && statusCode < 500) { // 4xx is user error, so just warn
26-
LOGGER.warn("URL: [{}] - Error response code: [{}] - Error:", url, statusCode, t);
36+
LOGGER.warn("URL: [{}], Participant: [{}] - Error response code: [{}] - Error:", url, participant, statusCode, t);
2737
}
2838
}
2939

0 commit comments

Comments
 (0)