logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-413) PatternLayout option to not output ANSI escape codes if no Console is available
Date Wed, 09 Oct 2013 00:39:42 GMT

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

Gary Gregory commented on LOG4J2-413:
-------------------------------------

When I implemented the patch attached to this issue, one thing that kept on popping up in
my head was if it would be easier if converters where given a Map of options instead of a
String[].

For example:

public static HighlightConverter newInstance(final Configuration config, final String[] options)
{
vs.
public static HighlightConverter newInstance(final Configuration config, final Map<String,
String> options) {

I did not go this way to make the patch smaller, but much more complex.

Since I did not code a solution with the Map alternative, I'm looking for feedback...

> PatternLayout option to not output ANSI escape codes if no Console is available
> -------------------------------------------------------------------------------
>
>                 Key: LOG4J2-413
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-413
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.0-beta9
>         Environment: Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19
08:51:28-0500)
> Maven home: C:\Java\apache-maven-3.0.5\bin\..
> Java version: 1.7.0_25, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_25\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>         Attachments: LOG4J2-413.diff
>
>
> In some environments, like the Eclipse IDE, logging to the Java Console is redirected
to the GUI. In this context, ANSI escape codes mean nothing and show up as "garbage" on the
screen. 
> This condition can be detected, if java.lang.System.console() returns null, like it does
in Eclipse, then we should optionally not output ANSI codes.
> It would be best to provide this as an option such that ANSI codes could still be written
to a file for later viewing on the console.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

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


Mime
View raw message