From 0ee672f95f27b26eddc127e6d358e1e6d462b020 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 4 Mar 2020 14:11:41 +0100 Subject: add "remoteHost" information into TransactionIdUtils rename MDC variables for Logging --- .../eaaf/core/impl/utils/TransactionIdUtils.java | 31 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java index 4cbcfa70..5a26eea3 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java @@ -29,21 +29,25 @@ import at.gv.egiz.eaaf.core.api.IRequest; */ public class TransactionIdUtils { - // MDC variables for logging /** * To correlate technical logs over one single transactions. */ - public static final String MDC_TRANSACTION_ID = "transactionId"; + public static final String MDC_TRANSACTION_ID = "transactionid"; /** * To correlate technical logs over a set of transactions, like SSO. */ - public static final String MDC_SESSION_ID = "sessionId"; + public static final String MDC_SESSION_ID = "sessionid"; /** * Unique application identifier that is processed in this transaction. */ - public static final String MDC_SERVICEPROVIDER_ID = "oaId"; + public static final String MDC_SERVICEPROVIDER_ID = "oaid"; + + /** + * Unique application identifier that is processed in this transaction. + */ + public static final String MDC_REMOTEHOST = "remoteHost"; /** * Set all MDC variables from pending request to this threat context.
@@ -67,6 +71,7 @@ public class TransactionIdUtils { removeSessionId(); removeTransactionId(); removeServiceProviderId(); + removeRemoteHost(); } @@ -135,5 +140,23 @@ public class TransactionIdUtils { } + /** + * Set remoteHost information to correlate technical logs. + * + * @param remoteHost IP address of the remote host + */ + public static void setRemoteHost(final String remoteHost) { + org.slf4j.MDC.put(MDC_REMOTEHOST, remoteHost); + + } + + /** + * Remove remoteHost for Logging. + */ + public static void removeRemoteHost() { + org.slf4j.MDC.remove(MDC_REMOTEHOST); + + } + } -- cgit v1.2.3