audit-service-war/src/main/java/org/apache/logging/log4j/audit/service/RequestContext.java [61:156]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static final String LOCAL_HOST_NAME = NetUtils.getLocalHostname();
    /**
     * The Supplier is used to populate the hostName key after the hostName value from the caller has been
     * placed into the callingHost map entry.
     */
    @Chained(fieldName = HOST_NAME, chainedFieldName = CALLING_HOST)
    public static final Supplier<String> LOCAL_HOST_SUPPLIER = () -> LOCAL_HOST_NAME;
    /**
     * The methods in this class are not required by framework components that use the RequestContext properties.
     * They are provided as a convenience for applications. If they are not provided the properties can be accessed
     * directly through the Log4j ThreadContext Map using the keys above.
     */
    public static void clear() {
        ThreadContext.clearMap();
    }

    public static String getRequestId() {
        String uuidStr = ThreadContext.get(REQUEST_ID);
        UUID uuid;
        if (uuidStr == null) {
            uuid = UuidUtil.getTimeBasedUuid();
            ThreadContext.put(REQUEST_ID, uuid.toString());
        }
        return uuidStr;
    }

    public static String getSessionId() {
        return ThreadContext.get(SESSION_ID);
    }

    public static void setSessionId(UUID sessionId) {
        if (sessionId != null) {
            ThreadContext.put(SESSION_ID, sessionId.toString());
        }
    }

    public static void setSessionId(String sessionId) {
        if (sessionId != null) {
            ThreadContext.put(SESSION_ID, sessionId);
        }
    }

    public static void setAccountNumber(Long accountNumber) {
        ThreadContext.put(ACCOUNT_NUMBER, accountNumber.toString());
    }

    public static Long getAccountNumber() {
        String value = ThreadContext.get(ACCOUNT_NUMBER);
        if (value == null || value.length() == 0) {
            return 0L;
        }
        try {
            return Long.parseLong(value);
        } catch (Exception e) {
            return 0L;
        }
    }

    public static void setIpAddress(String address) {
        ThreadContext.put(IP_ADDRESS, address);
    }

    public static String getIpAddress() {
        return ThreadContext.get(IP_ADDRESS);
    }

    public static void setUserId(String userId) {
        ThreadContext.put(USER_ID, userId);
    }

    public static String getUserId() {
        return ThreadContext.get(USER_ID);
    }

    public static void setLoginId(String loginId) {
        ThreadContext.put(LOGIN_ID, loginId);
    }

    public static String getLoginId() {
        return ThreadContext.get(LOGIN_ID);
    }

    public static String getHostName() {
        return ThreadContext.get(HOST_NAME);
    }

    public static void setHostName(String hostName) {
        ThreadContext.put(HOST_NAME, hostName);
    }

    public static String getCallingHost() {
        return ThreadContext.get(CALLING_HOST);
    }

    public static void setCallingHost(String hostName) {
        ThreadContext.put(CALLING_HOST, hostName);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



sample-app/src/main/java/org/apache/logging/audit/RequestContext.java [53:148]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static final String LOCAL_HOST_NAME = NetUtils.getLocalHostname();
    /**
     * The Supplier is used to populate the hostName key after the hostName value from the caller has been
     * placed into the callingHost map entry.
     */
    @Chained(fieldName = HOST_NAME, chainedFieldName = CALLING_HOST)
    public static final Supplier<String> LOCAL_HOST_SUPPLIER = () -> LOCAL_HOST_NAME;
    /**
     * The methods in this class are not required by framework components that use the RequestContext properties.
     * They are provided as a convenience for applications. If they are not provided the properties can be accessed
     * directly through the Log4j ThreadContext Map using the keys above.
     */
    public static void clear() {
        ThreadContext.clearMap();
    }

    public static String getRequestId() {
        String uuidStr = ThreadContext.get(REQUEST_ID);
        UUID uuid;
        if (uuidStr == null) {
            uuid = UuidUtil.getTimeBasedUuid();
            ThreadContext.put(REQUEST_ID, uuid.toString());
        }
        return uuidStr;
    }

    public static String getSessionId() {
        return ThreadContext.get(SESSION_ID);
    }

    public static void setSessionId(UUID sessionId) {
        if (sessionId != null) {
            ThreadContext.put(SESSION_ID, sessionId.toString());
        }
    }

    public static void setSessionId(String sessionId) {
        if (sessionId != null) {
            ThreadContext.put(SESSION_ID, sessionId);
        }
    }

    public static void setAccountNumber(Long accountNumber) {
        ThreadContext.put(ACCOUNT_NUMBER, accountNumber.toString());
    }

    public static Long getAccountNumber() {
        String value = ThreadContext.get(ACCOUNT_NUMBER);
        if (value == null || value.length() == 0) {
            return 0L;
        }
        try {
            return Long.parseLong(value);
        } catch (Exception e) {
            return 0L;
        }
    }

    public static void setIpAddress(String address) {
        ThreadContext.put(IP_ADDRESS, address);
    }

    public static String getIpAddress() {
        return ThreadContext.get(IP_ADDRESS);
    }

    public static void setUserId(String userId) {
        ThreadContext.put(USER_ID, userId);
    }

    public static String getUserId() {
        return ThreadContext.get(USER_ID);
    }

    public static void setLoginId(String loginId) {
        ThreadContext.put(LOGIN_ID, loginId);
    }

    public static String getLoginId() {
        return ThreadContext.get(LOGIN_ID);
    }

    public static String getHostName() {
        return ThreadContext.get(HOST_NAME);
    }

    public static void setHostName(String hostName) {
        ThreadContext.put(HOST_NAME, hostName);
    }

    public static String getCallingHost() {
        return ThreadContext.get(CALLING_HOST);
    }

    public static void setCallingHost(String hostName) {
        ThreadContext.put(CALLING_HOST, hostName);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



