[
https://issues.jboss.org/browse/WFCORE-3891?page=com.atlassian.jira.plugi...
]
James Perkins commented on WFCORE-3891:
---------------------------------------
This is due to the {{named-formatter}} attribute being undefined. When left undefined the
{{formatter}} attribute is used and a new
{{org.jboss.logmanager.formatters.PatternFormatter}} is created with the name of the
handler. Since the handler is named {{test}} it creates a new pattern formatter
configuration named {{test}} which is why the {{pattern-formatter}} works yet other
formatters do not.
The simplest workaround is just to define the {{named-formatter}} attribute. You can also
add a {{pattern-formatter}}, remove it, then add a new JSON or XML formatter with the same
name. Though I'd likely consider that a bug too since it leaves the handler with no
formatter assigned.
This is somewhat related to WFCORE-3337 as logging really should be using capabilities to
wire some validation into the configuration API. Some of this can be handled with
LOGMGR-179 however it would be a lot cleaner and result in better error messages to use
capabilities.
Cannot create xml-formatter and json-formatter with the same name as
existing resources in logging subsystem
------------------------------------------------------------------------------------------------------------
Key: WFCORE-3891
URL:
https://issues.jboss.org/browse/WFCORE-3891
Project: WildFly Core
Issue Type: Bug
Components: Logging
Reporter: Nikoleta Žiaková
Assignee: James Perkins
When trying to create an {{xml-formatter}} or {{json-formatter}} with the same name as
another resource (e.g. a {{file-handler}}), the operation fails:
{code}
[standalone@localhost:9990 /]
/subsystem=logging/file-handler=test:add(file={path=aaa.log})
{"outcome" => "success"}
[standalone@localhost:9990 /] /subsystem=logging/xml-formatter=test:add
{
"outcome" => "failed",
"failure-description" => "WFLYCTL0158: Operation handler failed:
java.lang.IllegalArgumentException: No property \"dateFormat\" setter found for
formatter \"test\"",
"rolled-back" => true
}
{code}
Similarly vice-versa, when trying to create another resource in logging subsystem with
the same name as an {{xml-formatter}} or a {{json-formatter}}, the operation fails:
{code}
[standalone@localhost:9990 /] /subsystem=logging/json-formatter=test:add
{"outcome" => "success"}
[standalone@localhost:9990 /]
/subsystem=logging/file-handler=test:add(file={path=test.log})
{
"outcome" => "failed",
"failure-description" => "WFLYCTL0158: Operation handler failed:
java.lang.IllegalArgumentException: No property \"pattern\" setter found for
formatter \"test\"",
"rolled-back" => true
}
{code}
The same scenario works for e.g. {{pattern-formatter}}:
{code}
[standalone@localhost:9990 /]
/subsystem=logging/file-handler=test:add(file={path=test.log})
{"outcome" => "success"}
[standalone@localhost:9990 /] /subsystem=logging/pattern-formatter=test:add
{"outcome" => "success"}
{code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)