karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (KARAF-5877) log4j2 appending error when using log4j2 XML configuration
Date Wed, 12 Sep 2018 06:40:00 GMT

     [ https://issues.apache.org/jira/browse/KARAF-5877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Freeman Fang reassigned KARAF-5877:

    Assignee: Freeman Fang

> 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
>            Assignee: Freeman Fang
>            Priority: Trivial
>             Fix For: 4.2.0
> {{LogServiceLog4j2XmlImpl}} will throw an {{org.w3c.dom.DOMException: NOT_FOUND_ERR}} when
the corresponding log4j2 configuration file has an element with children as the last element
in 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],
responsible for throwing the error.
> This is because the {{loggers}} object is a flat collection of the {{Loggers}} element's
children, and the {{insertAfter}} Node *can* be a nested child instead of a first level child.
Then, when {{loggers.insertBefore(node, insertAfter.getNextSibling())}} is called, and {{insertAfter}}
is not a first level child of the {{Loggers}} element, the exception is thrown. [This is becuase
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)].
> Steps to Reproduce:
> 1. Complete the steps in section `Log4j v2 support` of the [Karaf documentation|https://karaf.apache.org/manual/latest/].
> 2. Attempt to `log:tail` in the Karaf console.

This message was sent by Atlassian JIRA

View raw message