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

Brian commented on LOG4J2-518:
------------------------------

I am able to reproduce it with your code, after a slight modification.  I found 
the list has to be a certain length before this happens.  I.e., just using your 
code it does not happen, but once I make it 40 times longer with the same 
strings, it does:

{code}
        Logger log = LogManager.getLogger(PatternTestUTF8.class);
        List<String> list = Arrays.asList("a", "hello \u65e5\u672c\u8a9e", "b", 
"\u30c6\u30b9\u30c8", "c", "\u6f22\u5b57");
        
        List<String> longList = new ArrayList<String>();
        
        for (int i =0; i < 40; i++){
            longList.addAll(list);
        }
        
        List<List<String>> listOfList = Arrays.asList(longList, longList);
        log.info(listOfList);
        log.info(longList);
        log.info(listOfList.get(0));
{code}

I display the console output in Eclipse.  When I switched to output to a file 
instead, there was no issue.  Maybe the problem is with the console (in this 
case Eclipse console) itself as opposed to the logger or console logging in 
general?

> Logging of nested list uses incorrect charset
> ---------------------------------------------
>
>                 Key: LOG4J2-518
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-518
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders, Layouts
>    Affects Versions: 2.0-beta9
>         Environment: Windows 7
>            Reporter: Brian
>            Priority: Minor
>              Labels: list, utf-8
>
> When I log a list that contains UTF-8 (japanese characters) it works fine and 
> displays correctly in the console.  However, when this list is nested in 
> another list, it displays boxes with question marks.  When I copy and paste 
> these characters elsewhere they display correctly.
> E.g.:
>    LOG.info("Data columns: ");
>    LOG.info(dataColumns);
> gives:
>    INFO c.m.s.r.t.f.d.ListDataLoaderTest [main] [[phrase, phrase, phrase, 
> phrase, phrase ??????, phrase, ??????????, ...
> (where "?" are surrounded by boxes in my actual console output)
>         
> But:
>    LOG.info("Phrases: ");
>    LOG.info(dataColumns.get(0));
> gives:
>    [phrase, phrase, phrase, phrase, phrase モーター制御, phrase, ポップアップメニュー, 
> (i.e., the correct Japanese).
> Appender used:
> {code:xml}
>    <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout>
>          <pattern>%p %C{1.} [%t] %m%n</pattern>
>          <charset>UTF-8</charset>
>       </PatternLayout>
>    </Console>
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to