<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I talked to Tomaz a bit about this last Friday, but thought I would
    open it up to a wider audience and get others opinions as well.<br>
    <br>
    All handlers, except the async-handler, have an attribute called
    formatter. The formatter allows a string value which is the pattern
    used to format the log message. This only allows for the use of the
    org.jboss.logmanager.formatters.PatternFormatter.<br>
    <br>
    There is a JIRA [1], I thought an RFE too but I can't find it, to
    allow for the use of custom formatters. For example the use of
    java.util.logging.XMLFormatter. I actually think this could be
    useful. Possibly something like a JSONFormatter to help the console
    team with displaying log messages on the web console [2].<br>
    <br>
    There is also a JIRA [3] to allow the colors for the log output to
    be changed.<br>
    <br>
    The current model, we'll just use the console-handler for
    simplicity, looks like the following:<br>
    <tt>{</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "outcome" =&gt; "success",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "result" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "autoflush" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "enabled" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "encoding" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter-spec" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "formatter" =&gt; "%K{level}%d{HH:mm:ss,SSS} %-5p
      [%c] (%t) %s%E%n",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "level" =&gt; "INFO",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name" =&gt; "CONSOLE",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "target" =&gt; "System.out"</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>}</tt><br>
    <br>
    The easiest option (A) in both cases would be to add something like
    a "custom-formatter" attribute and a "formatter-color-mapping"
    attribute. What bothers me about this though is it doesn't seem
    logical. Having attributes that may or may not be used together
    doesn't make a lot of sense to me. <br>
    <br>
    Another option (B) would be to change the model to look something
    like:<br>
    <tt>{</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "outcome" =&gt; "success",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "result" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "autoflush" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "enabled" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "encoding" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter-spec" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "formatter" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "pattern" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "format-pattern" =&gt;
      "%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "color-mapping" =&gt;
      "warn=yellow,error=red,info=clear"</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "level" =&gt; "INFO",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name" =&gt; "CONSOLE",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "target" =&gt; "System.out"</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>}</tt><br>
    <br>
    -- OR --<br>
    <br>
    <tt>{</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "outcome" =&gt; "success",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; "result" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "autoflush" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "enabled" =&gt; true,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "encoding" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "filter-spec" =&gt; undefined,</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "formatter" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "custom" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "module" =&gt; "sun.jdk",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "class" =&gt;
      "java.util.logging.XMLFormatter",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "properties" =&gt; {</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "key1" =&gt; "value1",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "key2" =&gt; "value2"</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "level" =&gt; "INFO",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name" =&gt; "CONSOLE",</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "target" =&gt; "System.out"</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; }</tt><tt><br>
    </tt><tt>}</tt><br>
    <br>
    I know some people don't like complex attribute values. Personally I
    don't mind them, but they are a PITA with regards to CLI. A model
    change like this would also require some transformers for backwards
    compatibility. Though that doesn't really bother me all that much.<br>
    <br>
    Anyone have opinions on should be used? I tend to lean option B
    because it feels more logical.<br>
    <br>
    [1]:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="https://issues.jboss.org/browse/WFLY-1188">https://issues.jboss.org/browse/WFLY-1188</a><br>
    [2]:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="https://issues.jboss.org/browse/WFLY-1144">https://issues.jboss.org/browse/WFLY-1144</a><br>
    [3]:
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="https://issues.jboss.org/browse/WFLY-1059">https://issues.jboss.org/browse/WFLY-1059</a>
    <pre class="moz-signature" cols="72">-- 
James R. Perkins
Red Hat JBoss Middleware</pre>
  </body>
</html>