From 56f6da9375ca0467d0087893516325c0f5608ea6 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 10 Mar 2020 13:58:02 +0100 Subject: rename MDC variables for Session- and TransactionIds --- .../eaaf/core/impl/utils/TransactionIdUtils.java | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'eaaf_core_utils/src') 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 5a26eea3..4c1601c0 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 @@ -19,6 +19,8 @@ package at.gv.egiz.eaaf.core.impl.utils; +import java.util.UUID; + import at.gv.egiz.eaaf.core.api.IRequest; /** @@ -32,17 +34,17 @@ public class TransactionIdUtils { /** * 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. @@ -103,6 +105,14 @@ public class TransactionIdUtils { } + /** + * Set new random transactionId as an UUID. + */ + public static void setTransactionId() { + org.slf4j.MDC.put(MDC_TRANSACTION_ID, UUID.randomUUID().toString()); + + } + /** * Set Id to correlate technical logs over one single transactions. * @@ -121,6 +131,14 @@ public class TransactionIdUtils { } + /** + * Set a new random SessionId as UUID. + */ + public static void setSessionId() { + org.slf4j.MDC.put(MDC_SESSION_ID, UUID.randomUUID().toString()); + + } + /** * Set Id to correlate technical logs over a set of transactions, like SSO. * -- cgit v1.2.3