/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
@Override public void put(String key, String val) { _delegate.put(key, val != null ? val : ""); }
public static void set(String key, String value) { mdc.put(key, value); }
private void setDelegateContext() { // Logback's MDCConverter pulls in MDC properties through the slf4j's MDC class already. // Therefore there's no need to bridge two MDC implementations, like in the log4j PaxLoggerImpl. // See PAXLOGGING-165. MDCAdapter adapter = MDC.getMDCAdapter(); if (m_bundle != null && adapter != null) { adapter.put("bundle.id", String.valueOf(m_bundle.getBundleId())); adapter.put("bundle.name", m_bundle.getSymbolicName()); adapter.put("bundle.version", m_bundle.getVersion().toString()); } }
/** * Put a context value (the <code>val</code> parameter) as identified with * the <code>key</code> parameter into the current thread's context map. * The <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @throws IllegalArgumentException in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
public static void setJsonValue(String key, Object value) { try { if (value != null) { String json = JsonUtils.toJson(value); mdc.put(key, json); } } catch (Exception e) { // ignored } }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }
/** * Put a diagnostic context value (the <code>val</code> parameter) as identified with the * <code>key</code> parameter into the current thread's diagnostic context map. The * <code>key</code> parameter cannot be null. The <code>val</code> parameter * can be null only if the underlying implementation supports it. * * <p> * This method delegates all work to the MDC of the underlying logging system. * * @param key non-null key * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null */ public static void put(String key, String val) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key parameter cannot be null"); } if (mdcAdapter == null) { throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL); } mdcAdapter.put(key, val); }