The Layout just formats the data as you direct it to. Pattern Converters don’t 
have the intelligence to know whether they are targeting a Console or a File.  
You need to provide the pattern that is appropriate for the instance of the 
Layout you want depending on what Appender it is in.

Ralph

> On Jun 10, 2019, at 12:18 PM, Paul Benedict <pbened...@apache.org> wrote:
> 
> To stop me hardcoding repetitive patterns in Appenders, I defined several
> <Property> elements as such. Most my Appenders go to files and a couple to
> the console. In addition, to prevent a multiplicity of plain-text vs. color
> text patterns, I defined color conversions in my patterns.
> 
> Clearly, this dual purpose doesn't work.
> 
> My log files have escape characters in them. I understand why (ANSI color
> escape sequences), but I am really *surprised* to see them! Perhaps this
> was a bad assumption of mine, but .... it seemed absolutely natural/obvious
> to me that files have no colors. Thus, I was not expecting those color
> conversions to pose interference.
> 
> Does a use case exist for putting "colors" in files? If not, shouldn't a
> file Appender just elide that styling?
> 
> PS: I am using Log4J2 version 2.11.2.
> 
> Cheers and God bless,
> Paul



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to