Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3584

StatusLogger doesn't honor `log4j2.StatusLogger.DateFormat` property when status level is set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.19.0
    • Core
    • None

    Description

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

          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);
                      }
                  }
              }
          }
      

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

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

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

      Attachments

        Issue Links

          Activity

            People

              vy Volkan Yazici
              vy Volkan Yazici
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: