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

Single property to disable all color output

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
      None

      Description

      I am deploying an app to a Windows server. The app will write logs to standard output which will then be captured by some wrapper process.

      My default configuration contains ansi escapes for color, because they are nice for every situation except this one.

      It would be nice if there was a simple way to disable all ansi output via a system property and/or environment variable e.g.

      `-Dlog4j.ansi.enabled=false`

      This would operate similarly to the Spring Boot `spring.output.ansi.enabled` property (http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html).

      In Spring Boot I believe this is handled by using conditionals in their logback configuration (which would be super-nice in log4j also). With conditional layout I could very easily do this myself by specifying two different Pattern layouts in my config file, one with color and one without, conditional on some system property or env var I define.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                garydgregory Gary Gregory
                Reporter:
                rocketraman Raman Gupta
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: