diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java index 699dc66c8a7..b73fdc80752 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java @@ -39,6 +39,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.regex.Pattern; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.message.Message; @@ -209,6 +210,44 @@ public class StatusLogger extends AbstractLogger { */ public static final String PROPERTIES_FILE_NAME = "log4j2.StatusLogger.properties"; + /** + * Pattern that matches common separators in property names: + *
+ * These are removed during normalization. + *
+ */ + private static final Pattern SEPARATORS = Pattern.compile("[._-]"); + + /** + * Pattern that matches any character not in the ASCII Basic Latin block. + *+ * These characters are replaced with dots during normalization to avoid mismatches + * while preserving boundaries, e.g. {@code fooàö} becomes {@code foo..}. + *
+ */ + private static final Pattern NON_ASCII = Pattern.compile("\\P{InBasic_Latin}"); + + /** + * Pattern that matches the {@code log4j2} prefix at the start of the property name. + *+ * This is replaced with {@code log4j} for internal normalization. + *
+ */ + private static final Pattern PREFIX_LOG4J2 = Pattern.compile("^log4j2"); + + /** + * Pattern that matches property names starting with {@code log4j}, case-insensitively. + *+ * Used to determine if a given property name is relevant for Log4j configuration. + *
+ */ + private static final Pattern LOG4J_PREFIX = Pattern.compile("^log4j.*", Pattern.CASE_INSENSITIVE); + /** * Holder for user-provided {@link StatusLogger} configurations. * @@ -462,7 +501,8 @@ private static Map