问题
IDEA控制台tomcat 乱码
详细问题
项目部署至tomcat上,启动tomcat,IDEA控制台终端Server日志,Tomcat Localhost日志,Tomcat Catalina日志乱码
Server日志
D:\tomcat9\bin\catalina.bat run
[2023-05-29 11:20:24,521] Artifact bookmanagesystem:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442"
Using CATALINA_HOME: "D:\tomcat9"
Using CATALINA_TMPDIR: "D:\tomcat9\temp"
Using JRE_HOME: "D:\Java\jdk1.8.0_261"
Using CLASSPATH: "D:\tomcat9\bin\bootstrap.jar;D:\tomcat9\bin\tomcat-juli.jar"
Using CATALINA_OPTS: ""
29-May-2023 23:20:25.390 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Server.�������汾: Apache Tomcat/9.0.68
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log ����������: Oct 3 2022 19:06:10 UTC
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �������汾��: 9.0.68.0
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log ����ϵͳ����: Windows 10
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log OS.�汾: 10.0
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �ܹ�: amd64
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Java ��������: D:\Java\jdk1.8.0_261\jre
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Java������汾: 1.8.0_261-b12
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.��Ӧ��: Oracle Corporation
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\tomcat9
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.util.logging.config.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\conf\logging.properties
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dfile.encoding=UTF-8
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote=
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.port=1099
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.ssl=false
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.password.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\jmxremote.password
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.access.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\jmxremote.access
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.rmi.server.hostname=127.0.0.1
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djdk.tls.ephemeralDHKeySize=2048
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dignore.endorsed.dirs=
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcatalina.base=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcatalina.home=D:\tomcat9
29-May-2023 23:20:25.396 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.io.tmpdir=D:\tomcat9\temp
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent ʹ��APR�汾[1.7.0]�����˻���APR��Apache Tomcat������[1.2.35]��
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR���ܣ�IPv6[true]��sendfile[true]��accept filters[false]��random[true]��UDS [true]��
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL���ã�useAprConnector[false]��useOpenSSL[true]
29-May-2023 23:20:25.401 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL�ɹ���ʼ�� [OpenSSL 1.1.1q 5 Jul 2022]
29-May-2023 23:20:25.624 ��Ϣ [main] org.apache.coyote.AbstractProtocol.init ��ʼ��Э�鴦���� ["http-nio-8080"]
29-May-2023 23:20:25.643 ��Ϣ [main] org.apache.catalina.startup.Catalina.load ��������[390]�����ڳ�ʼ��
29-May-2023 23:20:25.663 ��Ϣ [main] org.apache.catalina.core.StandardService.startInternal ������������[Catalina]
29-May-2023 23:20:25.664 ��Ϣ [main] org.apache.catalina.core.StandardEngine.startInternal �������� Servlet ���棺[Apache Tomcat/9.0.68]
29-May-2023 23:20:25.672 ��Ϣ [main] org.apache.coyote.AbstractProtocol.start ��ʼЭ�鴦����["http-nio-8080"]
29-May-2023 23:20:25.684 ��Ϣ [main] org.apache.catalina.startup.Catalina.start [41]��������������
Connected to server
[2023-05-29 11:20:26,156] Artifact bookmanagesystem:war exploded: Artifact is being deployed, please wait...
29-May-2023 23:20:27.669 ��Ϣ [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars ������һ��JAR��ɨ������TLD����δ����TLD�� Ϊ�˼�¼�����õ�����־��¼���Ի�ȡ��ɨ�赫δ�������ҵ�TLD������JAR�б� ��ɨ���ڼ���������Ҫ��JAR������������ʱ���JSP����ʱ�䡣
Tomcat Catalina日志
29-May-2023 23:20:25.390 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Server.�������汾: Apache Tomcat/9.0.68
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log ����������: Oct 3 2022 19:06:10 UTC
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �������汾��: 9.0.68.0
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log ����ϵͳ����: Windows 10
29-May-2023 23:20:25.393 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log OS.�汾: 10.0
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �ܹ�: amd64
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Java ��������: D:\Java\jdk1.8.0_261\jre
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log Java������汾: 1.8.0_261-b12
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.��Ӧ��: Oracle Corporation
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\tomcat9
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.util.logging.config.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\conf\logging.properties
29-May-2023 23:20:25.394 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dfile.encoding=UTF-8
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote=
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.port=1099
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.ssl=false
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.password.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\jmxremote.password
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcom.sun.management.jmxremote.access.file=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442\jmxremote.access
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.rmi.server.hostname=127.0.0.1
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djdk.tls.ephemeralDHKeySize=2048
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dignore.endorsed.dirs=
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcatalina.base=C:\Users\86137\AppData\Local\JetBrains\IntelliJIdea2020.3\tomcat\7194f138-ba90-4dd6-b275-99d993578442
29-May-2023 23:20:25.395 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Dcatalina.home=D:\tomcat9
29-May-2023 23:20:25.396 ��Ϣ [main] org.apache.catalina.startup.VersionLoggerListener.log �����в����� -Djava.io.tmpdir=D:\tomcat9\temp
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent ʹ��APR�汾[1.7.0]�����˻���APR��Apache Tomcat������[1.2.35]��
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR���ܣ�IPv6[true]��sendfile[true]��accept filters[false]��random[true]��UDS [true]��
29-May-2023 23:20:25.398 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL���ã�useAprConnector[false]��useOpenSSL[true]
29-May-2023 23:20:25.401 ��Ϣ [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL�ɹ���ʼ�� [OpenSSL 1.1.1q 5 Jul 2022]
29-May-2023 23:20:25.624 ��Ϣ [main] org.apache.coyote.AbstractProtocol.init ��ʼ��Э�鴦���� ["http-nio-8080"]
29-May-2023 23:20:25.643 ��Ϣ [main] org.apache.catalina.startup.Catalina.load ��������[390]�����ڳ�ʼ��
29-May-2023 23:20:25.663 ��Ϣ [main] org.apache.catalina.core.StandardService.startInternal ������������[Catalina]
29-May-2023 23:20:25.664 ��Ϣ [main] org.apache.catalina.core.StandardEngine.startInternal �������� Servlet ���棺[Apache Tomcat/9.0.68]
29-May-2023 23:20:25.672 ��Ϣ [main] org.apache.coyote.AbstractProtocol.start ��ʼЭ�鴦����["http-nio-8080"]
29-May-2023 23:20:25.684 ��Ϣ [main] org.apache.catalina.startup.Catalina.start [41]��������������
29-May-2023 23:20:27.669 ��Ϣ [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars ������һ��JAR��ɨ������TLD����δ����TLD�� Ϊ�˼�¼�����õ�����־��¼���Ի�ȡ��ɨ�赫δ�������ҵ�TLD������JAR�б� ��ɨ���ڼ���������Ҫ��JAR������������ʱ���JSP����ʱ�䡣
29-May-2023 23:20:35.680 ��Ϣ [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory ��web Ӧ�ó�����Ŀ¼ [D:\tomcat9\webapps\manager]
29-May-2023 23:20:35.753 ��Ϣ [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars ������һ��JAR��ɨ������TLD����δ����TLD�� Ϊ�˼�¼�����õ�����־��¼���Ի�ȡ��ɨ�赫δ�������ҵ�TLD������JAR�б� ��ɨ���ڼ���������Ҫ��JAR������������ʱ���JSP����ʱ�䡣
29-May-2023 23:20:35.761 ��Ϣ [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory WebӦ�ó���Ŀ¼[D:\tomcat9\webapps\manager]�IJ�������[81]���������
解决方案
1、点击file——>settings
2 选择点击Editor—>选择点击General---->选择点击console
3 File Encodings 中将ISO-8859-1 更改为UTF-8 ,完了就,哦了
4 选择项目部署的tomcat,在配置项VM options文本框中输入-Dfile.encoding=UTF-8,点击Apply或OK即可。
5 打开logging.properties文件,找到文件中的java.util.logging.ConsoleHandler.encoding = UTF-8,
将其中的GBK改为UTF-8,保存后重启Tomcat服务,启动后就会看到刚才的乱码已经转换过来了。
解决原因
笔者之前在cmd窗口运行tomcat ,由于cmd窗口默认编码格式为GBK,tomcat配置文件规定cmd窗口输出格式为 UTF-8,出现乱码。
此次出现该问题,笔者疑惑:之前不是在cmd窗口已经解决该问题了,这次为何再次出现?
答案是一致的:
编码格式不统一,只需将编码格式修改统一即可。
笔者规定IDEA的所有编码格式为UTF-8,但是tomcat(由于笔者之前更改)规定编码格式为GBK,因此出现中文乱码问题,只需将tomcat配置文件中的编码格式更改为UTF-8即可。
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈