title: Java Logging API for Detailed (and multiline) Logs
body: <p>I'd like find an API that will allow me to provide a specific <strong>canonical set</strong> of information in all of my critical log points of my application. More specifically, it would be a multi-line message with the following information (in addition to the basics):</p>
  
  <ol>
  <li>Logging Category </li>
  <li>Short Description Title</li>
  <li>Description</li>
  <li>Response Action (damage control) my application will take </li>
  <li>Details (exception information, etc.)</li>
  </ol>
  
  <p>With a single multi-line log looking, for example, like so:</p>
  
  <pre><code>2017-11-10 14:26:59,156 [main] WARN o.s.t.c.s.ExampleClass:
      Caption: Unconformable data
      Description: The data provided from the X datasource in order to perform Y operation could not be translated
      Response Action: Application will discard unusable data into this component's DLQ
      Details: The data string "x" was not of expected Integer type
          &lt;Some stacktrace&gt;....
  </code></pre>
  
  <p>This is a verbose statement that would be very informative about exactly what occurred, where it occurred, and what the application is doing in response to the event of the exception.</p>
  
  <p>The closest I could find was the JBoss logging API and an example of some code I found in the <a href="https://github.com/apache/activemq-artemis/blob/master/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/ActiveMQUtilLogger.java" rel="nofollow noreferrer">ActiveMQ Artemis source</a>.
  The message format declaration can be defined in a single file like so:</p>
  
  <pre><code>   @LogMessage(level = Logger.Level.WARN)
     @Message(id = 202008, value = "Failed to check Address list {0}.",
        format = Message.Format.MESSAGE_FORMAT)
     void failedToParseAddressList(@Cause Exception e, String addressList);
  </code></pre>
  
  <p>And one would log a <a href="https://github.com/apache/activemq-artemis/blob/master/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java" rel="nofollow noreferrer">line with this message</a> in their code by writing:</p>
  
  <pre><code>ActiveMQUtilLogger.LOGGER.failedToParseAddressList(e, addressList);
  </code></pre>
  
  <p>That's the closest I could find to what I was looking for. Very cool. However, I'm not using JBoss (and also don't want to lock into that API).</p>
  
  <p>I can use LOG4J, which has a <a href="https://logging.apache.org/log4j/2.x/manual/lookups.html#StructuredDataLookup" rel="nofollow noreferrer">StructuredDataMessage and Structured Data Lookup</a> which can be used in a Layout, and I'll by default end up using that; my code could delegate to some <code>StructuredDataMessage</code> factory to solve this. However, it's a little bit bulkier than using something like this JBoss API.</p>
  
  <p><strong>Does anyone have any suggestions for this problem -- whether it's another API, a code patterns, or a nifty trick?</strong></p>