记一次Idea中Tomcat日志出现乱码的问题

Tomcat有时会出现日志输出乱码的问题,如

Connected to the target VM, address: '127.0.0.1:53135', transport: 'socket'
22-Jan-2019 14:10:19.099 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.37
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Dec 12 2018 12:07:02 UTC
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.37.0
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_121\jre
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_121-b13
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\hong\.IntelliJIdea2018.2\system\tomcat\Tomcat_9_0_0_M17_dfac
22-Jan-2019 14:10:19.103 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\Program Files\tomcat8.5.37

这里的原因可能是多种多样,这里记录下常用的修复方式,可以按照顺序依次尝试修复该问题。

  1. Idea Tomcat配置中添加VM Options: -Dfile.encoding=UTF-8

  2. 检查File->Settings->Editor->File Encodings

  3. 修改Tomcat下的配置文件conf/logging.properties

你可能感兴趣的:(记一次Idea中Tomcat日志出现乱码的问题)