You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Kamal Mettananda (JIRA)" <ji...@apache.org> on 2016/04/20 16:20:25 UTC
[jira] [Comment Edited] (LOG4J2-1372) XMLLayout indents, but not
the first child tag ()
[ https://issues.apache.org/jira/browse/LOG4J2-1372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15249967#comment-15249967 ]
Kamal Mettananda edited comment on LOG4J2-1372 at 4/20/16 2:19 PM:
-------------------------------------------------------------------
I have created a patch and attached here named [^LOG4J2-1372_01.patch] using below command.
{noformat}
git diff > LOG4J2-1372_01.patch
{noformat}
*Below are some information on my workspace (as I am a newbie into this project).*
At the time of the patch creation below was the status of my local workspace.
{noformat}
bash-4.1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
modified: log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
modified: log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
no changes added to commit (use "git add" and/or "git commit -a")
bash-4.1$
{noformat}
And the last commit that was visible to me was:
{noformat}
bash-4.1$ git log -1
commit 4195c7b365f0bba71f5a8aec59bf32dd90cc1f20
Author: ...
Date: Wed Apr 20 05:06:50 2016 -0700
LOG4J2-1363 - ...
bash-4.1$
{noformat}
Here is the sample XML generated after the fix is applied.
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Events xmlns="http://logging.apache.org/log4j/2.0/events">
<Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974522088" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="false" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
<Message>First Msg tag must be in level 2 after correct indentation</Message>
</Event>
<Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974522089" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
<Message>Second Msg tag must also be in level 2 after correct indentation</Message>
</Event>
</Events>{code}
was (Author: lkamal):
I have created a patch and attached here named [^LOG4J2-1372_01.patch] using below command.
{noformat}
git diff > LOG4J2-1372_01.patch
{noformat}
*Below are some information on my workspace (as I am a newbie into this project).*
At the time of the patch creation below was the status of my local workspace.
{noformat}
bash-4.1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java
modified: log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
modified: log4j-core/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
no changes added to commit (use "git add" and/or "git commit -a")
bash-4.1$
{noformat}
And the last commit that was visible to me was:
{noformat}
bash-4.1$ git log -1
commit 4195c7b365f0bba71f5a8aec59bf32dd90cc1f20
Author: ...
Date: Wed Apr 20 05:06:50 2016 -0700
LOG4J2-1363 - ...
bash-4.1$
{noformat}
> XMLLayout indents, but not the first child tag (<Event>)
> --------------------------------------------------------
>
> Key: LOG4J2-1372
> URL: https://issues.apache.org/jira/browse/LOG4J2-1372
> Project: Log4j 2
> Issue Type: Bug
> Components: Layouts
> Affects Versions: 2.5
> Reporter: Kamal Mettananda
> Priority: Minor
> Attachments: LOG4J2-1372_01.patch
>
>
> I am using log4j 2.5 to print the logs via XMLLayout. I have set compact="true", hence the new line and indents of sub tags work correctly. However I have noticed that the first child tag is not indented correctly.
> Following is such a sample where <Events> and <Event> are at the same indent level (0 indent).
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Events xmlns="http://logging.apache.org/log4j/2.0/events">
> <Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974404123" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
> <Message>First Msg tag must be in level 2 after correct indentation</Message>
> </Event>
> <Event xmlns="http://logging.apache.org/log4j/2.0/events" timeMillis="1460974404133" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="11" threadPriority="5">
> <Message>Second Msg tag must also be in level 2 after correct indentation</Message>
> </Event>
> </Events>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org