title: Is there a Logback Layout that Creates JSON Objects with Message Parameters as Attributes?
body: <p>I want to send log events to Loggly as JSON objects with parameterized string messages. Our project currently has a lot of code that looks like this:</p>
  
  <pre><code>String someParameter = "1234";
  logger.log("This is a log message with a parameter {}", someParameter);
  </code></pre>
  
  <p>We're currently using Logback as our SLF4J backend, and Logback's <a href="http://grepcode.com/file/repo1.maven.org/maven2/ch.qos.logback.contrib/logback-json-classic/0.1.1/ch/qos/logback/contrib/json/classic/JsonLayout.java" rel="noreferrer">JsonLayout</a> to serialize our ILogEvent objects into JSON. Consequentially, by they time our log events are shipped to Loggly, they look like this:</p>
  
  <pre><code>{
      "message": "This is a log message with a parameter 1234",
      "level": INFO,
      ....
  }
  </code></pre>
  
  <p>While this does work, it sends a different <code>message</code> string for every value of <code>someParameter</code>, which renders Loggly's automatic filters next to useless.</p>
  
  <p>Instead, I'd like to have a Layout that creates JSON that looks like this:</p>
  
  <pre><code>{
      "message": "This is a log message with a parameter {}",
      "level": INFO,
      "parameters": [
          "1234"
      ]
  }
  </code></pre>
  
  <p>This format would allow Loggly to group all log events with the message <code>This is a log message with a parameter</code> together, regardless of the value of <code>someParameter</code>.</p>
  
  <p>It looks like <a href="http://logstash.net/docs/1.1.5/filters/kv" rel="noreferrer">Logstash's KV filter</a> does something like this - is there any way to accomplish this task with Logback, short of writing my own layout that performs custom serialization of the ILogEvent object?</p>