feat: add logback-spring.xml UTF-8 console encoding and start.bat(chcp 65001) to fix Chinese log garbled on Windows console
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<!--
|
||||||
|
控制台日志统一使用 UTF-8 编码输出。
|
||||||
|
Windows cmd/PowerShell 下需先执行 chcp 65001 切换控制台代码页,
|
||||||
|
否则 UTF-8 中文日志在 GBK 控制台会显示为乱码。
|
||||||
|
推荐使用 start.bat 启动,已自动处理代码页切换。
|
||||||
|
-->
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 项目包名日志级别 -->
|
||||||
|
<logger name="com.freedom" level="INFO"/>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user