问题
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