Configuration example - Configuration example - Alfresco - Alfresco Content Services - Alfresco/Alfresco-Content-Services/23.4/Alfresco-Content-Services/Upgrade/Log4j2-Migration-Guide/SanitizingPatternLayout/Configuration-example - 23.4 - 23.4

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License
ft:lastPublication
2026-04-22T22:35:19.567073
ft:locale
en-US

Before (Log4j 1.x)

log4j.appender.Console.layout=org.alfresco.util.log.log4j.SanitizingPatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n

After (Log4j 2.x)

appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %replace{%m}{[\r\n]+}{}%n 

Notice the usage of the %replace{%m}{[\r\n]+}{} layout parameter to make sure logs are properly sanitized.