Index: /Users/dragonfly/Documents/workspace_sdavids/s/src/main/java/org/slf4j/MDC.java =================================================================== --- /Users/dragonfly/Documents/workspace_sdavids/s/src/main/java/org/slf4j/MDC.java (revision 858) +++ /Users/dragonfly/Documents/workspace_sdavids/s/src/main/java/org/slf4j/MDC.java (working copy) @@ -58,6 +58,29 @@ */ public class MDC { + private static final class NullAdapter implements MDCAdapter { + + /** {@inheritDoc}*/ + public void clear() { + //ignore + } + + /** {@inheritDoc}*/ + public String get(String key) { + return null; + } + + /** {@inheritDoc}*/ + public void put(String key, String val) { + //ignore + } + + /** {@inheritDoc}*/ + public void remove(String key) { + //ignore + } + } + static final String NULL_MDCA_URL = "http://www.slf4j.org/codes.html#null_MDCA"; static final String NO_STATIC_MDC_BINDER_URL = "http://www.slf4j.org/codes.html#no_static_mdc_binder"; static MDCAdapter mdcAdapter; @@ -73,9 +96,9 @@ if(msg != null && msg.indexOf("org/slf4j/impl/StaticMDCBinder") != -1) { Util.reportFailure("Failed to load class \"org.slf4j.impl.StaticMDCBinder\"."); Util.reportFailure("See "+NO_STATIC_MDC_BINDER_URL+" for further details."); - - } - throw ncde; + Util.reportFailure("Using Null-Adapter."); + } + mdcAdapter = new NullAdapter(); } catch (Exception e) { // we should never get here Util.reportFailure("Could not bind with an instance of class [" @@ -80,6 +103,8 @@ // we should never get here Util.reportFailure("Could not bind with an instance of class [" + StaticMDCBinder.SINGLETON.getMDCAdapterClassStr() + "]", e); + Util.reportFailure("Using Null-Adapter."); + mdcAdapter = new NullAdapter(); } }