idea 启动tomcat 项目 日志窗口乱码

问题描述:

今天启动一个ssm 项目,使用tomcat 启动,idea 日志窗口中文乱码

解决思路:

因为项目中有中文,肯定是哪里配置了UTF-8,但是有些地方又配置了其他的编码。比如:GBK。我们默认全部设置成UTF-8 即可。

解决步骤:

一,修改server.xml 的配置

打开tomcat 下的conf/server.xml ,在七十行左右插入代码 URIEcoding = "UTF-8"

   <Connector port="7080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

二,修改logging.properties 配置

打开tomcat 下的conf/logging.properties,添加一下代码


1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8

2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8

3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

java.util.logging.ConsoleHandler.encoding = UTF-8

 三,修改tomcat idea 配置

-Dfile.encoding=UTF-8

四,修改idea vm options

在help->Edit Custom VM Options...,添加 -Dfile.encoding=UTF-8

 

 重启即可。

采用如下配置即可,我看好多都是修改成GBK 的,但是我改成GBK无效。可自行判断下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

vegetari

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值