logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johno Crawford (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1572) Empty NDC stack logs null
Date Fri, 09 Sep 2016 08:04:21 GMT
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message