/** * ============LICENSE_START======================================================= * org.onap.logging * ================================================================================ * Copyright © 2018 Amdocs * All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.logging.ref.slf4j; import org.slf4j.Marker; import org.slf4j.MarkerFactory; /** * Constants for standard ONAP headers, MDCs, etc. * *
* See package-info.java. *
*/ public final class ONAPLogConstants { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Constructors. // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Hide and forbid construction. */ private ONAPLogConstants() { throw new UnsupportedOperationException(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Inner classes. // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Marker constants. */ public static final class Markers { /** Marker reporting invocation. */ public static final Marker INVOKE = MarkerFactory.getMarker("INVOKE"); /** Marker reporting invocation return. */ public static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE_RETURN"); /** Marker reporting synchronous invocation. */ public static final Marker INVOKE_SYNCHRONOUS = build("INVOKE", "SYNCHRONOUS"); /** Marker reporting asynchronous invocation. */ public static final Marker INVOKE_ASYNCHRONOUS = build("INVOKE", "ASYNCHRONOUS"); /** Marker reporting entry into a component. */ public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY"); /** Marker reporting exit from a component. */ public static final Marker EXIT = MarkerFactory.getMarker("EXIT"); /** * Build nested, detached marker. * * @param m1 top token. * @param m2 sub-token. * @return detached Marker. */ private static Marker build(final String m1, final String m2) { final Marker marker = MarkerFactory.getDetachedMarker(m1); marker.add(MarkerFactory.getDetachedMarker(m2)); return marker; } /** * Hide and forbid construction. */ private Markers() { throw new UnsupportedOperationException(); } } /** * MDC name constants. */ public static final class MDCs { // Tracing. //////////////////////////////////////////////////////////// /** MDC correlating messages for an invocation. */ public static final String INVOCATION_ID = "InvocationID"; /** MDC correlating messages for a logical transaction. */ public static final String REQUEST_ID = "RequestID"; /** MDC recording calling partner name. */ public static final String PARTNER_NAME = "PartnerName"; /** MDC recording current service. */ public static final String SERVICE_NAME = "ServiceName"; /** MDC recording target service. */ public static final String TARGET_SERVICE_NAME = "TargetServiceName"; /** MDC recording target entity. */ public static final String TARGET_ENTITY = "TargetEntity"; /** MDC recording target element. */ public static final String TARGET_ELEMENT = "TargetElement"; /** MDC recording current service instance id. */ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceID"; /** MDC recording current instance id. */ public static final String INSTANCE_UUID = "InstanceID"; // Network. //////////////////////////////////////////////////////////// /** MDC recording caller address. */ public static final String CLIENT_IP_ADDRESS = "ClientIPAddress"; /** MDC recording server IP address. */ public static final String SERVER_IP_ADDRESS = "ServerIPAddress"; /** MDC recording server FQDN. */ public static final String SERVER_FQDN = "ServerFQDN"; /** MDC recording virtual server name. */ public static final String VIRTUAL_SERVER_NAME = "VirtualServerName"; /** MDC recording context name. */ public static final String CONTEXT_NAME = "ContextName"; /** * MDC recording timestamp at the start of the current request, * with the same scope as {@link #REQUEST_ID}. * ** Open issues: *