今天在搭环境启动tomcat时,出现如下乱码:
03-Sep-2019 16:46:59.752 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\docs]
03-Sep-2019 16:47:03.868 璀﹀憡 [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [3,516] milliseconds.
03-Sep-2019 16:47:03.907 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\docs] has finished in [4,155] ms
03-Sep-2019 16:47:03.908 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\examples]
03-Sep-2019 16:47:05.092 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\examples] has finished in [1,184] ms
03-Sep-2019 16:47:05.093 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\host-manager]
03-Sep-2019 16:47:05.173 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\host-manager] has finished in [80] ms
03-Sep-2019 16:47:05.174 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\manager]
03-Sep-2019 16:47:05.256 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\manager] has finished in [81] ms
03-Sep-2019 16:47:05.256 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\ROOT]
03-Sep-2019 16:47:05.354 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\ROOT] has finished in [98] ms
03-Sep-2019 16:47:05.364 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8082"]
03-Sep-2019 16:47:05.389 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8011"]
03-Sep-2019 16:47:05.397 淇℃伅 [main] org.apache.catalina.startup.Catalina.start Server startup in 5725 ms
然后通过更改conf---logging.properties配置文件中的java.util.logging.ConsoleHandler.encoding = UTF-8,将“UTF-8”改成“GBK”,再重启tomcat,然后我们发现,变回中文了
03-Sep-2019 16:51:24.183 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\docs] has finished in [4,159] ms
03-Sep-2019 16:51:24.184 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\examples]
03-Sep-2019 16:51:25.128 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\examples] has finished in [944] ms
03-Sep-2019 16:51:25.129 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\host-manager]
03-Sep-2019 16:51:25.206 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\host-manager] has finished in [77] ms
03-Sep-2019 16:51:25.207 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\manager]
03-Sep-2019 16:51:25.278 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\manager] has finished in [71] ms
03-Sep-2019 16:51:25.279 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\ROOT]
03-Sep-2019 16:51:25.379 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\software\apache-tomcat-8.5.45-3\webapps\ROOT] has finished in [100] ms
03-Sep-2019 16:51:25.406 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8082"]
03-Sep-2019 16:51:25.428 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8011"]
03-Sep-2019 16:51:25.435 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 5534 ms