[
https://issues.apache.org/jira/browse/LOG4J2-1528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15458661#comment-15458661
]
Gary Gregory commented on LOG4J2-1528:
--------------------------------------
Nope:
{noformat}
org.junit.ComparisonFailure: expected:<...' encoding='UTF-8'?>[
<Configuration name="config name" status="ERROR" packages="foo,bar">
<Properties>
<Property name="MyKey">MyValue</Property>
</Properties>
<Scripts>
<ScriptFile name="target/test-classes/scripts/filter.groovy"
path="target/test-classes/scripts/filter.groovy" isWatched="true"/>
</Scripts>
<CustomLevels>
<CustomLevel name="Panic" intLevel="17"/>
</CustomLevels>
<ThresholdFilter onMatch="ACCEPT" onMisMatch="NEUTRAL" level="DEBUG"/>
<Appenders>
<CONSOLE name="Stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5level:
%msg%n%throwable"/>
<MarkerFilter onMatch="DENY" onMisMatch="NEUTRAL"
marker="FLOW"/>
</CONSOLE>
</Appenders>
<Loggers>
<Logger name="org.apache.logging.log4j" level="DEBUG"
includeLocation="true" additivity="false">
<AppenderRef ref="Stdout"/>
</Logger>
<Root level="ERROR">
<AppenderRef ref="Stdout"/>
</Root>
</Loggers>
</Configuration>
]
> but was:<...' encoding='UTF-8'?>[
<Configuration name="config name" status="ERROR" packages="foo,bar">
<Properties>
<Property name="MyKey">MyValue</Property>
</Properties>
<Scripts>
<ScriptFile name="target/test-classes/scripts/filter.groovy"
path="target/test-classes/scripts/filter.groovy" isWatched="true"/>
</Scripts>
<CustomLevels>
<CustomLevel name="Panic" intLevel="17"/>
</CustomLevels>
<ThresholdFilter onMatch="ACCEPT" onMisMatch="NEUTRAL" level="DEBUG"/>
<Appenders>
<CONSOLE name="Stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5level:
%msg%n%throwable"/>
<MarkerFilter onMatch="DENY" onMisMatch="NEUTRAL"
marker="FLOW"/>
</CONSOLE>
</Appenders>
<Loggers>
<Logger name="org.apache.logging.log4j" level="DEBUG"
includeLocation="true" additivity="false">
<AppenderRef ref="Stdout"/>
</Logger>
<Root level="ERROR">
<AppenderRef ref="Stdout"/>
</Root>
</Loggers>
</Configuration>]
>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at
org.apache.logging.log4j.core.config.builder.ConfigurationBuilderTest.testXmlConstructing(ConfigurationBuilderTest.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
{noformat}
Whatever the EOL is should be refactored into a variable or constant instead of
the current magic string.
> Serialize configuration into a log4j2.xml file
> ----------------------------------------------
>
> Key: LOG4J2-1528
> URL: https://issues.apache.org/jira/browse/LOG4J2-1528
> Project: Log4j 2
> Issue Type: New Feature
> Components: Configurators
> Affects Versions: 2.6.2
> Reporter: Mikael Ståldal
> Assignee: Mikael Ståldal
> Fix For: 2.7
>
>
> This would be useful for e.g. converting from Log4j 1 to Log4j 2 config.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]