Rare characters on log file using log4j2

大城市里の小女人 提交于 2020-01-17 02:52:08

问题


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 Starting messaging service ...

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

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

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

Thanks,

Joan.


回答1:


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"

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).



来源:https://stackoverflow.com/questions/29695248/rare-characters-on-log-file-using-log4j2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!