LOG4J2-1010 define ContextDataInjector that populates LogEvent's ContextData with ThreadContext values for each event
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/845d4d35 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/845d4d35 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/845d4d35 Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure Commit: 845d4d35fee37f5861e41f0bb6cfe3cf0015e8f6 Parents: c6a1856 Author: rpopma <[email protected]> Authored: Wed Jul 27 01:11:44 2016 +0900 Committer: rpopma <[email protected]> Committed: Wed Jul 27 01:11:44 2016 +0900 ---------------------------------------------------------------------- .../log4j/core/impl/ContextDataInjector.java | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/845d4d35/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java new file mode 100644 index 0000000..91e5617 --- /dev/null +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjector.java @@ -0,0 +1,39 @@ +/* + * 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.core.impl; + +import java.util.List; + +import org.apache.logging.log4j.core.config.Property; + +/** + * Responsible for initializing the ContextData of LogEvents. Context data is data that is set by the application to be + * included in all subsequent log events. + * + * @see org.apache.logging.log4j.core.ContextData + * @see org.apache.logging.log4j.ThreadContext + * @since 2.7 + */ +public interface ContextDataInjector { + /** + * Updates the specified ContextData with context key-value pairs. + * + * @param properties Properties from the configuration to be added to the ContextData + * @param contextData the ContextData to initialize + */ + void injectContextData(final List<Property> properties, final MutableContextData contextData); +}
