[ https://issues.apache.org/jira/browse/LOG4J2-1688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15656743#comment-15656743 ]
Stefan Hammelbeck commented on LOG4J2-1688: ------------------------------------------- Hi Gary, unfortunately I cannot test against a Git master build today. What I have done for now is to strip my test setting to log4j2 only (no more slf4j). I generated a small test project using log4j2 version 2.7 and junit only: *pom.xml* {code:xml} <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>my-current-tests</groupId> <artifactId>my-current-tests</artifactId> <version>0.0.1-SNAPSHOT</version> <name>sha-tests</name> <description>for testing only</description> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>2.7</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.7</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.7</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> </project> {code} *Test driver* {code} package de.stefan.test; import java.util.Arrays; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.spi.ExtendedLogger; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; @RunWith(BlockJUnit4ClassRunner.class) public class CheckLog4j2Test { /** * @param size * @return */ private static Object[] createArray(int size) { Object[] args = new Object[size]; for (int i = 0; i < args.length; i++) { args[i] = i; } return args; } @Test public void testLog4j2Only() { org.apache.logging.log4j.Logger log4JLogger = LogManager.getLogger(this.getClass()); Object[] args = createArray(33); ((ExtendedLogger)log4JLogger).logIfEnabled("org.apache.logging.slf4j.Log4jLogger", Level.ERROR, null, "test {}", args); System.out.println("args " + Arrays.toString(args)); ((ExtendedLogger)log4JLogger).logIfEnabled("org.apache.logging.slf4j.Log4jLogger", Level.ERROR, null, "test {}", args); System.out.println("args " + Arrays.toString(args)); } } {code} Executing the test above yields to the following result, where {{args}} are still resetted: {code} ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. 11:42:52.307 [main] ERROR de.stefan.test.CheckLog4j2Test - test 0 args [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] 11:42:52.308 [main] ERROR de.stefan.test.CheckLog4j2Test - test null args [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null] {code} > Multiple loggings of arguments are setting these arguments to null > ------------------------------------------------------------------ > > Key: LOG4J2-1688 > URL: https://issues.apache.org/jira/browse/LOG4J2-1688 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.7 > Reporter: Stefan Hammelbeck > > We are using SLF4J over log4j Version 2.7. > Calling {{org.slf4j.Logger.error(someFormat, args)}} *twice* with an > {{Object[] args}} causes all elements of {{args}} to be set to {{null}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org