<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> "outcome" => "success",</tt><tt><br>
</tt><tt> "result" => {</tt><tt><br>
</tt><tt> "autoflush" => true,</tt><tt><br>
</tt><tt> "enabled" => true,</tt><tt><br>
</tt><tt> "encoding" => undefined,</tt><tt><br>
</tt><tt> "filter" => undefined,</tt><tt><br>
</tt><tt> "filter-spec" => undefined,</tt><tt><br>
</tt><tt> "formatter" => "%K{level}%d{HH:mm:ss,SSS} %-5p
[%c] (%t) %s%E%n",</tt><tt><br>
</tt><tt> "level" => "INFO",</tt><tt><br>
</tt><tt> "name" => "CONSOLE",</tt><tt><br>
</tt><tt> "target" => "System.out"</tt><tt><br>
</tt><tt> }</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> "outcome" => "success",</tt><tt><br>
</tt><tt> "result" => {</tt><tt><br>
</tt><tt> "autoflush" => true,</tt><tt><br>
</tt><tt> "enabled" => true,</tt><tt><br>
</tt><tt> "encoding" => undefined,</tt><tt><br>
</tt><tt> "filter" => undefined,</tt><tt><br>
</tt><tt> "filter-spec" => undefined,</tt><tt><br>
</tt><tt> "formatter" => {</tt><tt><br>
</tt><tt> "pattern" => {</tt><tt><br>
</tt><tt> "format-pattern" =>
"%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",</tt><tt><br>
</tt><tt> "color-mapping" =>
"warn=yellow,error=red,info=clear"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> },</tt><tt><br>
</tt><tt> "level" => "INFO",</tt><tt><br>
</tt><tt> "name" => "CONSOLE",</tt><tt><br>
</tt><tt> "target" => "System.out"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>}</tt><br>
<br>
-- OR --<br>
<br>
<tt>{</tt><tt><br>
</tt><tt> "outcome" => "success",</tt><tt><br>
</tt><tt> "result" => {</tt><tt><br>
</tt><tt> "autoflush" => true,</tt><tt><br>
</tt><tt> "enabled" => true,</tt><tt><br>
</tt><tt> "encoding" => undefined,</tt><tt><br>
</tt><tt> "filter" => undefined,</tt><tt><br>
</tt><tt> "filter-spec" => undefined,</tt><tt><br>
</tt><tt> "formatter" => {</tt><tt><br>
</tt><tt> "custom" => {</tt><tt><br>
</tt><tt> "module" => "sun.jdk",</tt><tt><br>
</tt><tt> "class" =>
"java.util.logging.XMLFormatter",</tt><tt><br>
</tt><tt> "properties" => {</tt><tt><br>
</tt><tt> "key1" => "value1",</tt><tt><br>
</tt><tt> "key2" => "value2"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> },</tt><tt><br>
</tt><tt> "level" => "INFO",</tt><tt><br>
</tt><tt> "name" => "CONSOLE",</tt><tt><br>
</tt><tt> "target" => "System.out"</tt><tt><br>
</tt><tt> }</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>