You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jacob Beyner (JIRA)" <ji...@apache.org> on 2018/08/20 21:00:00 UTC
[jira] [Updated] (KARAF-5877) log4j2 appending error when using
log4j2 XML configuration
[ https://issues.apache.org/jira/browse/KARAF-5877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacob Beyner updated KARAF-5877:
--------------------------------
Description:
{{LogServiceLog4j2XmlImpl}} will throw an {{org.w3c.dom.DOMException: NOT_FOUND_ERR}} when trying to append to a nested element within the {{<Loggers>}} element. This causes the {{log:tail}} command to display the logs and error out immediately.
The reason for this is the {{LogServiceLog4j2XmlImpl.insertIndented}} method. It will eventually execute [this line|https://github.com/apache/karaf/blob/master/log/src/main/java/org/apache/karaf/log/core/internal/LogServiceLog4j2XmlImpl.java#L159]. This can throw an error when the last child element within the {{Loggers}} element has children of its own.
This is because the {{loggers}} object is a flat collection of all of the {{Loggers}} element's children. When {{loggers.insertBefore(node, insertAfter.getNextSibling())}} is called, the {{insertAfter}} Node is not be a first level child of the {{Loggers}} element. [The {{Node.insertBefore}} method requires the second argument to be a direct child of the node calling the method|https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#insertBefore(org.w3c.dom.Node,%20org.w3c.dom.Node)], resulting in a {{NOT_FOUND_ERR}}.
was:
{{LogServiceLog4j2XmlImpl}} will throw an {{org.w3c.dom.DOMException: NOT_FOUND_ERR}} when trying to append to a nested element within the {{<Loggers>}} element. This causes the {{log:tail}} command to display the logs and error out immediately.
The reason for this is the {{LogServiceLog4j2XmlImpl.insertIndented}} method. It will eventually execute [this line|https://github.com/apache/karaf/blob/master/log/src/main/java/org/apache/karaf/log/core/internal/LogServiceLog4j2XmlImpl.java#L159]. This can throw an error when the last child element within the {{Loggers}} element has children of its own.
This is because the {{loggers}} object is a flat collection of all of the {{Loggers}} element's children. When {{loggers.insertBefore(node, insertAfter.getNextSibling())}} is called, the {{insertAfter}} Node is not be a first level child of the {{Loggers}} element. The {{Node.insertBefore}} method requires the second argument to be a direct child of the node calling the method, resulting in a {{NOT_FOUND_ERR}}.
> log4j2 appending error when using log4j2 XML configuration
> ----------------------------------------------------------
>
> Key: KARAF-5877
> URL: https://issues.apache.org/jira/browse/KARAF-5877
> Project: Karaf
> Issue Type: Bug
> Components: karaf-logging
> Affects Versions: 4.2.0
> Reporter: Jacob Beyner
> Priority: Trivial
> Fix For: 4.2.0
>
>
> {{LogServiceLog4j2XmlImpl}} will throw an {{org.w3c.dom.DOMException: NOT_FOUND_ERR}} when trying to append to a nested element within the {{<Loggers>}} element. This causes the {{log:tail}} command to display the logs and error out immediately.
> The reason for this is the {{LogServiceLog4j2XmlImpl.insertIndented}} method. It will eventually execute [this line|https://github.com/apache/karaf/blob/master/log/src/main/java/org/apache/karaf/log/core/internal/LogServiceLog4j2XmlImpl.java#L159]. This can throw an error when the last child element within the {{Loggers}} element has children of its own.
> This is because the {{loggers}} object is a flat collection of all of the {{Loggers}} element's children. When {{loggers.insertBefore(node, insertAfter.getNextSibling())}} is called, the {{insertAfter}} Node is not be a first level child of the {{Loggers}} element. [The {{Node.insertBefore}} method requires the second argument to be a direct child of the node calling the method|https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#insertBefore(org.w3c.dom.Node,%20org.w3c.dom.Node)], resulting in a {{NOT_FOUND_ERR}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)