使用IDEA运行Tomcat程序的时候,在控制台出现了乱码问题。

31-Mar-2025 15:01:55.454 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲鍒扮洰褰� [D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager]
31-Mar-2025 15:01:55.721 淇℃伅 [Catalina-utility-1] org.apache.jasper.servlet.TldScanner.scanJars 鑷冲皯鏈変竴涓狫AR琚壂鎻忕敤浜嶵LD浣嗗皻鏈寘鍚玊LD銆� 涓烘璁板綍鍣ㄥ惎鐢ㄨ皟璇曟棩蹇楄褰曪紝浠ヨ幏鍙栧凡鎵弿浣嗘湭鍦ㄥ叾涓壘鍒癟LD鐨勫畬鏁碕AR鍒楄〃銆� 鍦ㄦ壂鎻忔湡闂磋烦杩囦笉闇�瑕佺殑JAR鍙互缂╃煭鍚姩鏃堕棿鍜孞SP缂栬瘧鏃堕棿銆�
31-Mar-2025 15:01:55.846 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Web搴旂敤绋嬪簭鐩綍[D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager]鐨勯儴缃插凡鍦╗390]姣鍐呭畬鎴�
31-Mar-2025 15:01:55.454 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲鍒扮洰褰� [D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager] 31-Mar-2025 15:01:55.721 淇℃伅 [Catalina-utility-1] org.apache.jasper.servlet.TldScanner.scanJars 鑷冲皯鏈変竴涓狫AR琚壂鎻忕敤浜嶵LD浣嗗皻鏈寘鍚玊LD銆� 涓烘璁板綍鍣ㄥ惎鐢ㄨ皟璇曟棩蹇楄褰曪紝浠ヨ幏鍙栧凡鎵弿浣嗘湭鍦ㄥ叾涓壘鍒癟LD鐨勫畬鏁碕AR鍒楄〃銆� 鍦ㄦ壂鎻忔湡闂磋烦杩囦笉闇�瑕佺殑JAR鍙互缂╃煭鍚姩鏃堕棿鍜孞SP缂栬瘧鏃堕棿銆� 31-Mar-2025 15:01:55.846 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Web搴旂敤绋嬪簭鐩綍[D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager]鐨勯儴缃插凡鍦╗390]姣鍐呭畬鎴�
31-Mar-2025 15:01:55.454 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲鍒扮洰褰� [D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager]
31-Mar-2025 15:01:55.721 淇℃伅 [Catalina-utility-1] org.apache.jasper.servlet.TldScanner.scanJars 鑷冲皯鏈変竴涓狫AR琚壂鎻忕敤浜嶵LD浣嗗皻鏈寘鍚玊LD銆� 涓烘璁板綍鍣ㄥ惎鐢ㄨ皟璇曟棩蹇楄褰曪紝浠ヨ幏鍙栧凡鎵弿浣嗘湭鍦ㄥ叾涓壘鍒癟LD鐨勫畬鏁碕AR鍒楄〃銆� 鍦ㄦ壂鎻忔湡闂磋烦杩囦笉闇�瑕佺殑JAR鍙互缂╃煭鍚姩鏃堕棿鍜孞SP缂栬瘧鏃堕棿銆�
31-Mar-2025 15:01:55.846 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Web搴旂敤绋嬪簭鐩綍[D:\Software\tomcat\apache-tomcat-9.0.96-windows-x64\apache-tomcat-9.0.96\webapps\manager]鐨勯儴缃插凡鍦╗390]姣鍐呭畬鎴�

乱码的原因就是编码格式问题,我们打开Tomcat的目录,找到conf文件下的logging.properties文件,双击打开

打开文件修改如下:

把java.util.logging.ConsoleHandler.encoding = UTF-8 这行代码注释掉,然后增加下面的代码

java.util.logging.ConsoleHandler.encoding = GBK

保存后重启Tomcat,可以看到已经正常显示中文了。

分类: java