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] [Created] (LOG4J2-1459) [PatternLayout] Add an ANSI option to %message
Date Wed, 06 Jul 2016 21:45:11 GMT
Gary Gregory created LOG4J2-1459:

             Summary: [PatternLayout] Add an ANSI option to %message
                 Key: LOG4J2-1459
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1459
             Project: Log4j 2
          Issue Type: New Feature
            Reporter: Gary Gregory
            Assignee: Gary Gregory
             Fix For: 2.7

For {{PatternLayout}}: Add an ANSI option to {{message}} so you can say {{%message\{ansi\}}}
and allow ANSI escape syntax in your log even messages.

For example:

Using styles defined in the configuration:

         <Pattern>%message{ansi}{WarningStyle=red,bold KeyStyle=white ValueStyle=blue}%n</Pattern>
logger.error("@|WarningStyle Warning!|@ Pants on @|WarningStyle fire!|@");

Using hard-coded styles:
logger.error("@|red Warning!|@ Pants on @|blue fire!|@");

The {{"@|Style Text|@"}} is from JANSI but the markers can be user defined using {{BeginToken}}
and {{EndToken}}:

         <Pattern>%message{ansi}{BeginToken=@| EndToken=|@ WarningStyle=red,bold KeyStyle=white

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