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

Default status logger destination should be STDERR, not STDOUT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.13.3
    • None
    • Configuration
    • None

    Description

      Currently, the default status logging destination for internal Log4j logging is the standard output stream. This is problematic for command line tools whose output is processed by other processes. The default destination for Log4j internal logging should be STDERR.

      Note that initially (before the configuration is processed) the status logger actually does output to STDERR, but once the configuration is processed, the StatusLogger starts to delegate to the StatusListeners, and the StatusConsoleListener that is installed by the StatusConfiguration has their DEFAULT_STREAM set to System.out. I believe this is an oversight and the intention has always been for internal status logging to go to System.err.

      As a workaround, applications can explicitly configure the destination with the dest attribute:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="error" dest="err">
      ...
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rpopma Remko Popma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: