diff options
-rw-r--r-- | eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java | 31 |
1 files 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.<br> @@ -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); + + } + } |