Posts

Showing posts from August, 2016

Configure MDC with SLF4j Logback file in java

This article is all about how you configure MDC logs with SLF4J and logback. 1. Maven POM dependencies : Please add maven dependencies as given below.        <!-- Logging with SLF4J & LogBack --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.13</version> </dependency> 2. Configure logback.xml file <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="30 seconds"> <property name="DEV_HOME" value="c:/logs" />     <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">         <resetJUL>true</resetJUL>     </con...