Tomcat启动出现中文乱码的解决方案

启动Tomcat之后,会出现下面这样的乱码
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
22-Aug-2019 20:49:47.667 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.鏈嶅姟鍣ㄧ増鏈? Apache Tomcat/9.0.24

22-Aug-2019 20:49:47.679 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.鏋勫缓: Aug 14 2019 21:16:42 UTC
22-Aug-2019 20:49:47.687 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.24.0
22-Aug-2019 20:49:47.689 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
22-Aug-2019 20:49:47.694 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.鐗堟湰: 10.0
22-Aug-2019 20:49:47.696 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log 缁?閫? amd64

22-Aug-2019 20:49:47.701 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 鐜鍙橀噺: F:\Web\Java
22-Aug-2019 20:49:47.702 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM 鐗堟湰: 12.0.2+10
22-Aug-2019 20:49:47.703 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.渚涘簲鍟? Oracle Corporation

22-Aug-2019 20:49:47.705 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24
22-Aug-2019 20:49:47.706 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24
22-Aug-2019 20:49:47.712 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
22-Aug-2019 20:49:47.713 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
22-Aug-2019 20:49:47.713 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
22-Aug-2019 20:49:47.715 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\conf\logging.properties
22-Aug-2019 20:49:47.716 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
22-Aug-2019 20:49:47.717 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
22-Aug-2019 20:49:47.719 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
22-Aug-2019 20:49:47.722 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
22-Aug-2019 20:49:47.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24
22-Aug-2019 20:49:47.725 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24
22-Aug-2019 20:49:47.726 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\temp
22-Aug-2019 20:49:47.728 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.7.0].
22-Aug-2019 20:49:47.729 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
22-Aug-2019 20:49:47.732 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
22-Aug-2019 20:49:47.748 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1c 28 May 2019]
22-Aug-2019 20:49:48.269 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init 鍒濆鍖栧崗璁鐞嗗櫒 [“http-nio-8080”]
22-Aug-2019 20:49:49.088 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init 鍒濆鍖栧崗璁鐞嗗櫒 [“ajp-nio-8009”]
22-Aug-2019 20:49:49.100 淇℃伅 [main] org.apache.catalina.startup.Catalina.load 鏈嶅姟鍣ㄥ湪[1,910]姣鍐呭垵濮嬪寲
22-Aug-2019 20:49:49.207 淇℃伅 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
22-Aug-2019 20:49:49.208 淇℃伅 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.24]
22-Aug-2019 20:49:49.228 淇℃伅 [main] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲 鍒扮洰褰?[F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\webapps\docs]

22-Aug-2019 20:49:50.318 璀﹀憡 [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [677] milliseconds.
22-Aug-2019 20:49:50.356 淇℃伅 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\webapps\docs] has finished in [1,129] ms
22-Aug-2019 20:49:50.357 淇℃伅 [main] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲 鍒扮洰褰?[F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\webapps\examples]

22-Aug-2019 20:49:51.362 淇℃伅 [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\webapps\examples] has finished in [1,004] ms
22-Aug-2019 20:49:51.364 淇℃伅 [main] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲 鍒扮洰褰?[F:\Web\JavaWeb\apache-tomcat-9.0.24-windows-x64\apache-tomcat-9.0.24\webapps\host-manager]

其实正常情况下,有乱码并不影响使用,如果你的Tomcat不能使用,也不是因为这儿出现了乱码,而是因为别的地方出了问题,而乱码又恰好掩盖了错误提示,下面说一下乱码的解决方法
找到Tomcat的安装目录
Tomcat启动出现中文乱码的解决方案
从conf文件夹里打开logging.properties文件
找到 java.util.logging.ConsoleHandler.encoding = utf-8这一行, 更改为 java.util.logging.ConsoleHandler.encoding = GBK,重启Tomcat就可以了。
Tomcat启动出现中文乱码的解决方案

上一篇:cenos7创建删除软连接ln -s


下一篇:MySQL MHA switchover在线切换过程