问题
Is %replace and %enc supported in log4j 1.2.x?. Relevant configurations were found in log4j 2.x documentation [1] but not for older versions.
[1] https://logging.apache.org/log4j/2.x/manual/layouts.html
回答1:
No.
Features found in log4j 2 may not be found in log4j 1. According to their site:
The API for Log4j 2 is not compatible with Log4j 1.x, however an adapter is available to allow applications to continue to use the Log4j 1.x API.
http://logging.apache.org/log4j/2.x/
来源:https://stackoverflow.com/questions/40232714/log4j-1-2-replacepatternregexsubstitution-and-encpattern-not-working