idea 控制台log日志中文乱码解决方案

博客围绕Tomcat日志乱码问题展开,介绍了开发工具概况,展示了乱码问题。提出解决方案,即修改tomcat配置文件apache - tomcat - 7.0.92\\conf\\logging.properties,将编码从UTF - 8改为GBK并重启服务,但修改后System.out.println(time)中文出现乱码暂未解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、开发工具概况

开发工具概况
JDK1.8
Tomcat7.0.92
IntelliJ IDEA2018.2.1

二、乱码问题展示(部分内容)

······

浜旀湀 31, 2019 2:01:53 涓嬪崍 org.apache.catalina.startup.TaglibUriRule body
淇℃伅: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
浜旀湀 31, 2019 2:01:53 涓嬪崍 org.apache.catalina.startup.TaglibUriRule body
淇℃伅: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
浜旀湀 31, 2019 2:01:53 涓嬪崍 org.apache.catalina.startup.TaglibUriRule body
淇℃伅: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
浜旀湀 31, 2019 2:01:53 涓嬪崍 org.apache.catalina.startup.TaglibUriRule body
淇℃伅: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
浜旀湀 31, 2019 2:01:53 涓嬪崍 org.apache.catalina.startup.TldConfig execute
淇℃伅: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2019-05-31 02:01:53,706] Artifact DataExchangeCenter_xj:war exploded: Artifact is deployed successfully
[2019-05-31 02:01:53,707] Artifact DataExchangeCenter_xj:war exploded: Deploy took 5,301 milliseconds

三、解决方案

方法a、

         修改tomcat的配置文件   apache-tomcat-7.0.92\conf\logging.properties 

         将所有的 ···.encoding = UTF-8   改为   ···.encoding = GBK  重启服务即可。

############################################################

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
1catalina.org.apache.juli.AsyncFileHandler.encoding = GBK

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.encoding = GBK

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
3manager.org.apache.juli.AsyncFileHandler.encoding = GBK

4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
4host-manager.org.apache.juli.AsyncFileHandler.encoding = GBK

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.encoding = GBK


############################################################

效果展示:

五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TaglibUriRule body
信息: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TaglibUriRule body
信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TaglibUriRule body
信息: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TaglibUriRule body
信息: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TaglibUriRule body
信息: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
五月 31, 2019 1:55:36 下午 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2019-05-31 01:55:37,824] Artifact EnterpriseQuerySystem:war exploded: Artifact is deployed successfully
[2019-05-31 01:55:37,824] Artifact EnterpriseQuerySystem:war exploded: Deploy took 3,762 milliseconds

改后出现个问题,之前   System.out.println(time);  中文不乱码,现在乱码了,暂未 解决

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值