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 "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/08/31 18:00:27 UTC

[jira] [Reopened] (LOG4J2-1528) Serialize configuration into a log4j2.xml file

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

Gary Gregory reopened LOG4J2-1528:
----------------------------------

Broken unit test (on Windows 7 for me):

{code:java}
java.lang.AssertionError: 
Expected: Expected text value '
	' but was '
	' - comparing <Configuration ...>
	</Configuration> at /Configuration[1]/text()[1] to <Configuration ...>
	</Configuration> at /Configuration[1]/text()[1]:
<Configuration name="config name" packages="foo,bar" status="ERROR">
	<Properties>
		<Property name="MyKey">MyValue</Property>
	</Properties>
	<Scripts>
		<ScriptFile isWatched="true" name="target/test-classes/scripts/filter.groovy" path="target/test-classes/scripts/filter.groovy"/>
	</Scripts>
	<CustomLevels>
		<CustomLevel intLevel="17" name="Panic"/>
	</CustomLevels>
	<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMisMatch="NEUTRAL"/>
	<Appenders>
		<CONSOLE name="Stdout" target="SYSTEM_OUT">
			<PatternLayout pattern="%d [%t] %-5level: %msg%n%throwable"/>
			<MarkerFilter marker="FLOW" onMatch="DENY" onMisMatch="NEUTRAL"/>
		</CONSOLE>
	</Appenders>
	<Loggers>
		<Logger additivity="false" includeLocation="true" level="DEBUG" name="org.apache.logging.log4j">
			<AppenderRef ref="Stdout"/>
		</Logger>
		<Root level="ERROR">
			<AppenderRef ref="Stdout"/>
		</Root>
	</Loggers>
</Configuration>
     but: result was: 
<Configuration name="config name" packages="foo,bar" status="ERROR">&#13;
	<Properties>&#13;
		<Property name="MyKey">MyValue</Property>&#13;
	</Properties>&#13;
	<Scripts>&#13;
		<ScriptFile isWatched="true" name="target/test-classes/scripts/filter.groovy" path="target/test-classes/scripts/filter.groovy"/>&#13;
	</Scripts>&#13;
	<CustomLevels>&#13;
		<CustomLevel intLevel="17" name="Panic"/>&#13;
	</CustomLevels>&#13;
	<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMisMatch="NEUTRAL"/>&#13;
	<Appenders>&#13;
		<CONSOLE name="Stdout" target="SYSTEM_OUT">&#13;
			<PatternLayout pattern="%d [%t] %-5level: %msg%n%throwable"/>&#13;
			<MarkerFilter marker="FLOW" onMatch="DENY" onMisMatch="NEUTRAL"/>&#13;
		</CONSOLE>&#13;
	</Appenders>&#13;
	<Loggers>&#13;
		<Logger additivity="false" includeLocation="true" level="DEBUG" name="org.apache.logging.log4j">&#13;
			<AppenderRef ref="Stdout"/>&#13;
		</Logger>&#13;
		<Root level="ERROR">&#13;
			<AppenderRef ref="Stdout"/>&#13;
		</Root>&#13;
	</Loggers>&#13;
</Configuration>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.junit.Assert.assertThat(Assert.java:956)
	at org.junit.Assert.assertThat(Assert.java:923)
	at org.apache.logging.log4j.core.config.builder.ConfigurationBuilderTest.testXmlConstructing(ConfigurationBuilderTest.java:88)
	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)
{code}

> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org