Inconsistent behavior of "<" character in logging format pattern between CLI and XML in EAP 6

Solution Verified - Updated -

Issue

Are there any rules documented related to the syntax to use when you want to use literal < and > in a pattern of a pattern-formatter?

My theory based upon testing is:

  • use &lt; for <
  • use > for > (&gt; is not required)

When updating the formatter via CLI, I can use literal characters, but that's not the case when modifying the XML. Say I have a pattern in XML:

<pattern-formatter pattern="&lt;%d{yyyy.MM.dd HH:mm:ss SSS Z}&gt;&lt;%-5p&gt;&lt;null&gt;&lt;%t&gt;&lt;%c&gt; %m%E%n"/>

after updating it via the CLI, it is changed to:

<pattern-formatter pattern="&lt;%d{yyyy.MM.dd HH:mm:ss SSS Z}>&lt;%-5p>&lt;null>&lt;%t>&lt;%c> %m%E%n"/>

So the XML persister changes &gt; to >.

But say I want to add %C at the end of the pattern. So I pull the pattern from the XML and use the following CLI command:

[standalone@localhost:9999 /] /subsystem=logging/custom-handler=FILE:write-attribute(name="formatter", value="&lt;%d{yyyy.MM.dd HH:mm:ss SSS Z}>&lt;%-5p>&lt;null>&lt;%t>&lt;%c>&lt;%C> %m%E%n")
{"outcome" => "success"}

Pattern updated now has:

<pattern-formatter pattern="&amp;lt;%d{yyyy.MM.dd HH:mm:ss SSS Z}>&amp;lt;%-5p>&amp;lt;null>&amp;lt;%t>&amp;lt;%c>&amp;lt;%C> %m%E%n"/>

Which is incorrect, my logs now look like this:

&lt;2014.02.13 16:11:20 944 -0500>&lt;DEBUG>&lt;null>&lt;some-loggingThread>&lt;custom.mbean.MyServerMonitor>&lt;custom.mbean.MyServerMonitor$1> THREAD DEBUG from MYServerMonitor LOG4J

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.