Update property tokenizer to support ENV_VAR_STYLE This makes the property name tokenizer now support case-insensitive log4j(2) prefixes only at the beginning of a property name.
Also adds a missing license header. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/fd39ef45 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/fd39ef45 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/fd39ef45 Branch: refs/heads/LOG4J2-1431 Commit: fd39ef45225b60fc7d99b07e4303c4c802ca9929 Parents: d777b6f Author: Matt Sicker <[email protected]> Authored: Sun Feb 5 15:29:58 2017 -0600 Committer: Matt Sicker <[email protected]> Committed: Sat Aug 26 15:50:56 2017 -0500 ---------------------------------------------------------------------- .../logging/log4j/util/PropertySource.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fd39ef45/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java index 4dd9cf3..a197aec 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ package org.apache.logging.log4j.util; import java.io.Serializable; @@ -60,8 +76,8 @@ public interface PropertySource { * @since 2.9 */ final class Util { - private static final String PREFIXES = "(?:[Ll]og4j2?|org\\.apache\\.logging\\.log4j\\.)?"; - private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+)[-._/]?"); + private static final String PREFIXES = "(?i:^log4j2?[-._/]?|^org\\.apache\\.logging\\.log4j\\.)?"; + private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+|[A-Z0-9]+)[-._/]?"); private static final Map<CharSequence, List<CharSequence>> CACHE = new ConcurrentHashMap<>(); /**
