使用log4j2的日志文件上的稀有字符 [英] Rare characters on log file using log4j2

查看:132
本文介绍了使用log4j2的日志文件上的稀有字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用同步记录器登录文件时,偶尔会出现稀有字符.参见下面的"^ [[?1; 2c ^ [[?1; 2c"(1.2.17不会发生这种情况).

When logging to a file with a sync logger, rare characters occasionally appear. See below "^[[?1;2c^[[?1;2c" (this does not happen with 1.2.17).

2015-04-02 13:58:51正在启动消息服务...

2015-04-02 13:58:51 Starting messaging service ...

^ [[?1; 2c ^ [[?1; 2c2015-04-02 13:59:06消息服务已成功启动.

^[[?1;2c^[[?1;2c2015-04-02 13:59:06 Messaging service successfully started.

2015-04-02 13:59:06正在启动平衡器测试端口...

2015-04-02 13:59:06 Starting balancer test port ...

我的log4j.xml是这样的: http://www.grupoventus.com/download/log4j .xml

My log4j.xml is this: http://www.grupoventus.com/download/log4j.xml

谢谢

琼.

推荐答案

这些奇怪的字符是Linux/UNIX控制台代码(请参见

These strange characters are Linux/UNIX consoles codes (see here). These codes are often used to specify the color to use in the console, but here it seems to specify the terminal type, I found this here:

/*
 * this is what the terminal answers to a ESC-Z or csi0c query.
 */
#define VT100ID "\033[?1;2c"

在日志条目(Log4j日志消息)的%m"部分中,检查哪个添加程序/记录器用于了解谁在尝试使用此类特殊字符.

Check which appender/logger is used to know who is trying to use such special characters in the "%m" part of the log entry (Log4j log message).

这篇关于使用log4j2的日志文件上的稀有字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆