Skip to content

Unwanted TRACE output in v2.23.1 with -Dlog4j.debug=false #2703

Closed
@vkolomeyko

Description

@vkolomeyko

Description

The effect of -Dlog4j.debug=false has changed in v2.23.1

Configuration

Version: 2.23.1

Operating system: Windows

JDK: zulu17.46.19-ca-jdk17.0.9-win_x64

Reproduction

Consider the following Java program:

package org.example;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Main {

    public static void main(String[] args) {
        System.setProperty("log4j.debug", "false");

        Logger log = LogManager.getLogger(Main.class);
        log.error("Hello world!");
    }
}

With Log4j v2.23.0 it prints:

15:20:02.690 [main] ERROR org.example.Main - Hello world!

as expected.

However, when version is upgraded to v2.23.1, the output becomes a lot more verbose:

...
2024-07-03T14:23:42.658351400Z main TRACE Using default SystemClock for timestamps.
2024-07-03T14:23:42.658351400Z main DEBUG org.apache.logging.log4j.core.util.SystemClock supports precise timestamps.
2024-07-03T14:23:42.658351400Z main TRACE Using DummyNanoClock for nanosecond timestamps.
2024-07-03T14:23:42.658351400Z main DEBUG Reconfiguration complete for context[name=1d44bcfa] at URI NULL_SOURCE (org.apache.logging.log4j.core.LoggerContext@67e2d983) with optional ClassLoader: null
2024-07-03T14:23:42.658351400Z main DEBUG Shutdown hook enabled. Registering a new one.
2024-07-03T14:23:42.659352600Z main DEBUG LoggerContext[name=1d44bcfa, org.apache.logging.log4j.core.LoggerContext@67e2d983] started OK.
15:23:42.661 [main] ERROR org.example.Main - Hello world!
2024-07-03T14:23:42.663882800Z pool-1-thread-1 DEBUG Stopping LoggerContext[name=1d44bcfa, org.apache.logging.log4j.core.LoggerContext@67e2d983]
2024-07-03T14:23:42.664881900Z pool-1-thread-1 DEBUG Stopping LoggerContext[name=1d44bcfa, org.apache.logging.log4j.core.LoggerContext@67e2d983]...
2024-07-03T14:23:42.664881900Z pool-1-thread-1 TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=1d44bcfa]
...

which is unexpected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions