[
https://issues.apache.org/jira/browse/LOG4J2-1459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380212#comment-15380212
]
Gary Gregory commented on LOG4J2-1459:
--------------------------------------
I got the idea from [~ralphgoers]:
{noformat}
---------- Forwarded message ----------
From: Ralph Goers <[email protected]>
Date: Sat, Jun 25, 2016 at 4:02 PM
Subject: Re: I can see! (colors)
To: Log4J Developers List <[email protected]>
Why wouldn’t you just do:
%m{ansi}
%m{html}
%m{styled}
Ralph
{noformat}
> [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:
> {code:xml}
> <PatternLayout>
> <Pattern>%message{ansi}{WarningStyle=red,bold KeyStyle=white
> ValueStyle=blue}%n</Pattern>
> </PatternLayout>
> {code}
> {code:java}
> logger.error("@|WarningStyle Warning!|@ Pants on @|WarningStyle fire!|@");
> {code}
> Using hard-coded styles:
> {code:java}
> logger.error("@|red Warning!|@ Pants on @|blue fire!|@");
> {code}
> The {{"@|Style Text|@"}} syntax is from JANSI but the markers can be user
> defined using {{BeginToken}} and {{EndToken}}:
> {code:xml}
> <PatternLayout>
> <Pattern>%message{ansi}{BeginToken=@| EndToken=|@ WarningStyle=red,bold
> KeyStyle=white ValueStyle=blue}%n</Pattern>
> </PatternLayout>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]