Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-255

Multi-byte character strings are scrambled in log output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0-beta6
    • 2.0-beta7
    • Appenders, Core
    • None

    Description

      When I tried to log a Japanese string the output was scrambled in both the Console and a log file.

      For example,
      logger.warn("日本語テスト"); // (Japanese test)

      came out as
      15:07:00.184 [main] WARN test.JapaneseTest - 譌・譛ャ隱槭ユ繧ケ繝?

      This is the log4j2.xml configuration:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration status="warn">
          <appenders>
              <Console name="Console" target="SYSTEM_OUT">
                  <PatternLayout>
                      <pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
                      </pattern>
                  </PatternLayout>
              </Console>
              <File name="tracelog" fileName="trace-log.txt" immediateFlush="true" append="false">
                  <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
              </File>
          </appenders>
          
          <loggers>
              <root level="trace">
                  <appender-ref ref="Console"/>
                  <appender-ref ref="tracelog"/>
              </root>
          </loggers>
      </configuration>
      

      Attachments

        Issue Links

          Activity

            People

              rpopma Remko Popma
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: