title: How to write slf4j-over-logback logs as JSON
body: <p>I have the below logging statements in my code.</p>
  
  <pre><code>import org.slf4j.Logger;
  
  public class MySampleClass {
  
  private static final Logger logger = LoggerFactory.getLogger(MySmapleClass.class);
  
      public void mySampleMethod(List&lt;String&gt; userID) {
          logger.debug("userRuntimeId =" + userId);
          .
          .
          .
          Business Logic
          .
          .
  
      }
  }
  </code></pre>
  
  <p>My log configs are available in:
  <strong>logback-common.xml</strong>
  <a href="https://i.stack.imgur.com/P0oST.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P0oST.png" alt="enter image description here"></a></p>
  
  <p><strong>logback-local.xml</strong>
  <a href="https://i.stack.imgur.com/sgX4g.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sgX4g.png" alt="enter image description here"></a></p>
  
  <p>This prints my logs as given below,</p>
  
  <blockquote>
    <p>2019-02-25 16:27:45,460 | DEBUG | [fileTaskExecutor-2] |
    [a.abc.mySampleApp.handlers.userRecordHandler] | [MY_SAMPLE_APP] |
    [Vijay-20190225-162738.trigger] | [] | userRuntimeId =
    3051aa39-2e0a-11e9-bee3-e7388cjg5le0</p>
  </blockquote>
  
  <p><strong><em>I want to print the logs as JSON. How do I do it?</em></strong></p>
  
  <p>Sample JSON format I expect:</p>
  
  <pre><code>{
  timestamp="2019-02-25 16:27:45,460" ,
  level="DEBUG",
  triggerName="fileTaskExecutor-2",
  className="a.abc.mySampleApp.handlers.userRecordHandler",
  appName="MY_SAMPLE_APP",
  userRuntimeId="3051aa39-2e0a-11e9-bee3-e7388cjg5le0"
  }
  </code></pre>