Add custom jul.Level for unit tests.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/25399022 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/25399022 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/25399022 Branch: refs/heads/LOG4J2-608 Commit: 253990222665d78b9b7f9568a26cb609138fcb38 Parents: d1cb742 Author: Matt Sicker <[email protected]> Authored: Mon Sep 1 18:24:39 2014 -0500 Committer: Matt Sicker <[email protected]> Committed: Mon Sep 1 18:24:39 2014 -0500 ---------------------------------------------------------------------- .../logging/log4j/jdk/CustomJdkLevel.java | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/25399022/log4j-jdk/src/test/java/org/apache/logging/log4j/jdk/CustomJdkLevel.java ---------------------------------------------------------------------- diff --git a/log4j-jdk/src/test/java/org/apache/logging/log4j/jdk/CustomJdkLevel.java b/log4j-jdk/src/test/java/org/apache/logging/log4j/jdk/CustomJdkLevel.java new file mode 100644 index 0000000..d125d0e --- /dev/null +++ b/log4j-jdk/src/test/java/org/apache/logging/log4j/jdk/CustomJdkLevel.java @@ -0,0 +1,40 @@ +/* + * 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.jdk; + +import java.util.logging.Level; + +/** + * Custom JUL Level for unit tests. + */ +public class CustomJdkLevel extends Level { + + private static final long serialVersionUID = 4681718777617726164L; + + protected CustomJdkLevel(final String name, final int value) { + super(name, value); + } + + // inside CONFIG range; should map to INFO + public static final Level TEST = new CustomJdkLevel("TEST", 600); + + // just 1 below Level.SEVERE; should map to ERROR + public static final Level DEFCON_2 = new CustomJdkLevel("DEFCON_2", 999); + + // above Level.SEVERE; should map to FATAL + public static final Level DEFCON_1 = new CustomJdkLevel("DEFCON_1", 10000); +}
