logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raman Gupta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-1685) Single property to disable all color output
Date Thu, 10 Nov 2016 19:51:58 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15654956#comment-15654956

Raman Gupta commented on LOG4J2-1685:

Looking at the existing code, I see an option noConsoleNoAnsi, however this option only takes
effect if System.console() == null. This is not always true -- for example, an app logging
to standard output inside a docker container will have System.console() != null, however in
this environment it may still be useful to disable ansi.

I have therefore added a parallel option `disableAnsi` in the attached patch, which disables
ansi unconditionally.



> Single property to disable all color output
> -------------------------------------------
>                 Key: LOG4J2-1685
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1685
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.7
>            Reporter: Raman Gupta
>            Priority: Minor
> 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
> 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.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message