Windows Tomcat console log is garbled

Problem Description

When opening Tomcat, the cmd console and idea both show garbled characters, but the log files are all normal

the reason

cmd defaults to GBK encoding
cmd enter chcp and press enter to view

Note: CHCP is a computer command that can display or set the active code page number.
Code page description
65001 UTF-8 code page
950 Traditional Chinese
936 Simplified Chinese Default GBK
437 MS-DOS US English

Solution

Comment out encoding = UTF-8 in conf/logging.properties, the following line

java.util.logging.ConsoleHandler.encoding = UTF-8

This line of code means that the log encoding format printed on the console using log is utf-8, but I started it with windows. The windows console defaults to gbk encoding, which conflicts with utf-8 encoding, so it causes garbled characters.

Guess you like

Origin blog.csdn.net/curtis0730/article/details/89158282