Java slf4j Logger putMDCs(String clientId, String subjectId)

Here you can find the source of putMDCs(String clientId, String subjectId)

Description

put MD Cs

License

Apache License

Declaration

public static void putMDCs(String clientId, String subjectId) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.slf4j.MDC;

public class Main {
    /**//from w  w  w.j  a v a2  s . c om
     * MDC-key for the category
     */
    public static final String CATEGORY = "category";
    /**
     * MDC-key for the client-id
     */
    public static final String CLIENT_ID = "client-id";
    /**
     * MDC-key for the subject-id
     */
    public static final String SUBJECT_ID = "subject-id";

    public static void putMDCs(String clientId, String subjectId) {
        MDC.put(CLIENT_ID, clientId);
        MDC.put(SUBJECT_ID, subjectId);
    }

    public static void putMDCs(String category, String clientId, String subjectId) {
        MDC.put(CATEGORY, category);
        MDC.put(CLIENT_ID, clientId);
        MDC.put(SUBJECT_ID, subjectId);
    }
}

Related

  1. printPrettyJson(Logger logger, String json)
  2. printRequestLog(Map reqParam)
  3. printResponseLog(String res)
  4. printStackTrace(Logger logger, Throwable e)
  5. profilerTrigger2(Logger log, String msg)
  6. request(String infoMessage)
  7. restoreContext(Map mdcContextMap)
  8. rosettaShell(ArrayList a)
  9. set(String key, String value)