package io.tracee.backend.jbosslogging;

import io.tracee.MDCLike;
import org.jboss.logging.MDC;

import java.util.HashMap;
import java.util.Map;

final class JbossLoggingMdcLikeAdapter implements MDCLike {

    @Override
    public boolean containsKey(String key) {
        return MDC.get(key) != null;
    }

    @Override
    public void put(String key, String value) {
        MDC.put(key, value);
    }

    @Override
    public String get(String key) {
        return String.valueOf(MDC.get(key));
    }

    @Override
    public void remove(String key) {
        MDC.remove(key);
    }

    @Override
    public Map<String, String> getCopyOfContext() {
        final Map<String, Object> map = MDC.getMap();
        final Map<String, String> copy = new HashMap<String, String>(map.size());
        for (Map.Entry<String, Object> entry : map.entrySet()) {
			copy.put(entry.getKey(), String.valueOf(entry.getValue()));
        }
        return copy;
    }
}

package io.tracee.backend.jbosslogging;

import io.tracee.MDCLike;
import org.jboss.logging.MDC;

import java.util.HashMap;
import java.util.Map;

final class JbossLoggingMdcLikeAdapter implements MDCLike {

    @Override
    public boolean containsKey(String key) {
        return MDC.get(key) != null;
    }

    @Override
    public void put(String key, String value) {
        MDC.put(key, value);
    }

    @Override
    public String get(String key) {

        return (String) MDC.get(key);
    }

    @Override
    public void remove(String key) {
        MDC.remove(key);
    }

    @Override
    public Map<String, String> getCopyOfContext() {
        final Map<String, Object> map = MDC.getMap();
        final Map<String, String> copy = new HashMap<String, String>(map.size());
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            if (!(entry.getValue() instanceof String)) continue;
            copy.put(entry.getKey(), (String) entry.getValue());
        }
        return copy;
    }
}

--- 
+++ 
@@ -20,8 +20,7 @@
 
     @Override
     public String get(String key) {
-
-        return (String) MDC.get(key);
+        return String.valueOf(MDC.get(key));
     }
 
     @Override
@@ -34,8 +33,7 @@
         final Map<String, Object> map = MDC.getMap();
         final Map<String, String> copy = new HashMap<String, String>(map.size());
         for (Map.Entry<String, Object> entry : map.entrySet()) {
-            if (!(entry.getValue() instanceof String)) continue;
-            copy.put(entry.getKey(), (String) entry.getValue());
+			copy.put(entry.getKey(), String.valueOf(entry.getValue()));
         }
         return copy;
     }
Use String.valueOf() instead. It's more robust against Object values in the MDC.
