You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Volkan Yazici (Jira)" <ji...@apache.org> on 2022/08/30 19:56:00 UTC

[jira] [Created] (LOG4J2-3584) StatusLogger doesn't honor `log4j2.StatusLogger.DateFormat` property when status level is set

Volkan Yazici created LOG4J2-3584:
-------------------------------------

             Summary: StatusLogger doesn't honor `log4j2.StatusLogger.DateFormat` property when status level is set
                 Key: LOG4J2-3584
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3584
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
            Reporter: Volkan Yazici
             Fix For: 2.19.0


I think {{StatusLogger}} doesn't honor {{log4j2.StatusLogger.DateFormat}} property, when configuration has a status level set. That is, in the following {{StatusLogger}} block:

{code}
    public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg,
            final Throwable t) {
        // ...
        // LOG4J2-1813 if system property "log4j2.debug" is defined, all status logging is enabled
        if (isDebugPropertyEnabled() || (listeners.size() <= 0)) {
            logger.logMessage(fqcn, level, marker, msg, t);
        } else {
            for (final StatusListener listener : listeners) {
                if (data.getLevel().isMoreSpecificThan(listener.getStatusLevel())) {
                    listener.log(data);
                }
            }
        }
    }
{code}

When {{status="trace"}} is set in {{log4j2.xml}}, {{else}} block kicks in. There the following {{StatusConsoleListener}} method gets called:

{code}
    public void log(final StatusData data) {
        if (!filtered(data)) {
            stream.println(data.getFormattedStatus());
        }
    }
{code}

There {{StatusData#getFormattedStatus()}} completely ignores {{log4j2.StatusLogger.DateFormat}} while formatting the date.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)