0 Replies Latest reply on Sep 16, 2019 11:03 AM by timo.schoepflin

    SLF4J MDC / Thread Context Support in Thorntail

    timo.schoepflin

      I implemented a custom java.util.logging.Formatter to use for our thorntail based apps.

      I'm using the formatter as described here https://docs.thorntail.io/2.4.0.Final/#_logging for the property thorntail.logging.custom-formatters.KEY.attribute-class.

       

      Unfortunately I'm not able to access the MDC information in the Formatter, since JUL has no MDC support.

      I tried to use MDC.getCopyOfContextMap(), but this always returns null, since we only have NOPMDCAdapter at Runtime

       

      Previously we used a LOG4J config, however this was only applied to our application logs and not to the thorntail logs.

       

      Does someone have an idea how I can use either an Log4J Layout for Thorntail or how I can access the MDC information in JUL.