Adobe Global Community

Customized Logging using SLF4J / MDC in AEM

Published on by Ryan McCullough on blogs.perficientdigital.com
Out of the box, AEM provides a pattern based logging system which comes pre-configured with an MessageFormat pattern for logging. This is a somewhat legacy messaging format, which, for most applications, has been updated with a 'Logback' implementation. The main reason for said replacement is the flexibility that logback techniques can offer, including a more customized log pattern support, in addition to the ability to add in mapped variables, or in logback terminology, Mapped Diagnostic Context, or MDC. AEM comes bundled with SLF4J, and therefore already has support for logback patterns, and more importantly, MDC. What is missing here is how to populate the variable which needs to be logged on each request, and how to manipulate your logging patterns to accommodate said variable.

Tags


comments powered by Disqus

Get Insights from the AGC!

Related Posts