Johno Crawford created LOG4J2-1572:
--------------------------------------

             Summary: Empty NDC stack logs null
                 Key: LOG4J2-1572
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1572
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.6.2
            Reporter: Johno Crawford
            Priority: Trivial


Expected behavior

When the NDC stack is empty nothing should be logged (regression in log4j 2.x, 
the functionality behaves this way in log4j 1.2).

ex. 2016-09-09 09:54:44,212 INFO  [main] Main (Main.java:6) - huuhaa

Actual behavior

When the NDC stack is empty null is logged.

ex. 2016-09-09 09:54:44,212 INFO  [main] Main (Main.java:6) - huuhaa null

```java
import org.apache.logging.log4j.LogManager;

public class Main {

    public static void main(String[] args) {
        LogManager.getLogger(Main.class).info("huuhaa");
    }
}
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
  <Appenders>
    <Console name="STDOUT" target="SYSTEM_OUT">
      <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m %x%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Root level="INFO">
      <AppenderRef ref="STDOUT"/>
    </Root>
  </Loggers>
</Configuration>
```



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to