How to escape only message instead of all row in log4j?
问题 I have the following PatternLayout: public class EscapedEnhancedPatternLayout extends EnhancedPatternLayout { @Override public String format(LoggingEvent event) { return StringEscapeUtils.escapeJava(super.format(event)); } } but this escapes full logging row. I want to have something like this but only for message. but LoggingEvent class has not setMessage and setRenderedMessage methods. And I don't see copy constructor at LoggingEvent . If LoggingEvent had copy constructor I can inherited