In my log4j2.properties file, I used:

appender.console.type = Console
appender.console.name = STDERR
appender.console.target = SYSTEM_ERR
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = 🐈%style{%d{ISO8601}}{dim,cyan}
%style{[}{red}%style{%-8c{2}}{dim,blue}%style{]}{red}
%highlight{%-5p}%style{:}{red} %m%n

I did not try to specify a charset at first, but my understanding is that
the default is to use UTF-8, which should work, but it prints 'ð' instead
of '🐈'.
Strangely, even though my terminal is using UTF-8, log4j prints correctly
when I add:

appender.console.layout.charset = ISO-8859-1

Setting this to 'UTF-8' explicitly does not work. I don't know if this is a
bug, or some charset confusion on my part (I try to stick to UTF-8
everywhere, but perhaps I missed something). Perhaps the config file itself
is being read as ISO-8859-1, even though it contains UTF-8 characters and I
made sure to explicitly save it with a UTF-8 BOM.

On Tue, Mar 10, 2020 at 5:58 PM Ralph Goers <ralph.go...@dslextreme.com>
wrote:

> Did you specify a charset on the layout that supports that character?
>
> Ralph
>
> > On Mar 10, 2020, at 1:57 PM, Christopher <ctubb...@apache.org> wrote:
> >
> > I tried to put in a kitty (🐈) in my LayoutPattern, but it didn't
> > work. It replaced it with some weird character. Is this is a known
> > bug?
> > Does PatternLayout not support wide characters?
> >
>
>
>

Reply via email to