Repository: logging-log4j2 Updated Branches: refs/heads/release-2.x 363984f1f -> 5ae9affa5
Adds a TriggeringPolicy that never triggers and is handy for edge-cases in tests for example. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5ae9affa Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5ae9affa Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5ae9affa Branch: refs/heads/release-2.x Commit: 5ae9affa51c1fb0cbfe728aa5ff0106340eaf02f Parents: 363984f Author: Gary Gregory <[email protected]> Authored: Fri Jul 13 18:00:54 2018 -0600 Committer: Gary Gregory <[email protected]> Committed: Fri Jul 13 18:00:54 2018 -0600 ---------------------------------------------------------------------- .../appender/rolling/NoOpTriggeringPolicy.java | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5ae9affa/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/NoOpTriggeringPolicy.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/NoOpTriggeringPolicy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/NoOpTriggeringPolicy.java new file mode 100644 index 0000000..d28da42 --- /dev/null +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/NoOpTriggeringPolicy.java @@ -0,0 +1,43 @@ +/* + * 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.appender.rolling; + +import org.apache.logging.log4j.core.Core; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.config.plugins.Plugin; + +/* + * Never triggers and is handy for edge-cases in tests for example. + * + * @since 2.11.1 + */ +@Plugin(name = "NoOpTriggeringPolicy", category = Core.CATEGORY_NAME, printObject = true) +public class NoOpTriggeringPolicy extends AbstractTriggeringPolicy { + + @Override + public void initialize(final RollingFileManager manager) { + // NoOp + } + + @Override + public boolean isTriggeringEvent(final LogEvent logEvent) { + // NoOp + return false; + } + +}
