/*
 * 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.jul;

import java.util.IdentityHashMap;
import java.util.Map;

import org.apache.logging.log4j.Level;

/**
 * Default implementation of LevelConverter strategy.
 *
 * @since 2.1
 */
public class DefaultLevelConverter implements LevelConverter {

    private final Map<java.util.logging.Level, Level> JDK_TO_LOG4J =
        new IdentityHashMap<java.util.logging.Level, Level>(9);
    private final Map<Level, java.util.logging.Level> LOG4J_TO_JDK =
        new IdentityHashMap<Level, java.util.logging.Level>(10);

    public DefaultLevelConverter() {
        JDK_TO_LOG4J.put(java.util.logging.Level.OFF, Level.OFF);
        JDK_TO_LOG4J.put(java.util.logging.Level.FINEST, LevelTranslator.FINEST);
        JDK_TO_LOG4J.put(java.util.logging.Level.FINER, Level.TRACE);
        JDK_TO_LOG4J.put(java.util.logging.Level.FINE, Level.DEBUG);
        JDK_TO_LOG4J.put(java.util.logging.Level.CONFIG, LevelTranslator.CONFIG);
        JDK_TO_LOG4J.put(java.util.logging.Level.INFO, Level.INFO);
        JDK_TO_LOG4J.put(java.util.logging.Level.WARNING, Level.WARN);
        JDK_TO_LOG4J.put(java.util.logging.Level.SEVERE, Level.ERROR);
        JDK_TO_LOG4J.put(java.util.logging.Level.ALL, Level.ALL);
        LOG4J_TO_JDK.put(Level.OFF, java.util.logging.Level.OFF);
        LOG4J_TO_JDK.put(LevelTranslator.FINEST, java.util.logging.Level.FINEST);
        LOG4J_TO_JDK.put(Level.TRACE, java.util.logging.Level.FINER);
        LOG4J_TO_JDK.put(Level.DEBUG, java.util.logging.Level.FINE);
        LOG4J_TO_JDK.put(LevelTranslator.CONFIG, java.util.logging.Level.CONFIG);
        LOG4J_TO_JDK.put(Level.INFO, java.util.logging.Level.INFO);
        LOG4J_TO_JDK.put(Level.WARN, java.util.logging.Level.WARNING);
        LOG4J_TO_JDK.put(Level.ERROR, java.util.logging.Level.SEVERE);
        LOG4J_TO_JDK.put(Level.FATAL, java.util.logging.Level.SEVERE);
        LOG4J_TO_JDK.put(Level.ALL, java.util.logging.Level.ALL);
    }

    @Override
    public Level toLevel(final java.util.logging.Level javaLevel) {
        return JDK_TO_LOG4J.get(javaLevel);
    }

    @Override
    public java.util.logging.Level toJavaLevel(final Level level) {
        return LOG4J_TO_JDK.get(level);
    }
}

@@ -1128,28 +1128,26 @@
  Level%3E 
-JDK_TO_LOG4J
+julToLog4j
  =%0A     
@@ -1259,28 +1259,26 @@
 .Level%3E 
-LOG4J_TO_JDK
+log4jToJul
  =%0A     
@@ -1379,36 +1379,62 @@
 ) %7B%0A        
-JDK_TO_LOG4J
+// Map JUL to Log4j%0A        julToLog4j
 .put(java.ut
@@ -1471,36 +1471,34 @@
 F);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1551,36 +1551,34 @@
 T);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1619,36 +1619,34 @@
 E);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1686,36 +1686,34 @@
 G);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1766,36 +1766,34 @@
 G);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1832,36 +1832,34 @@
 O);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1901,36 +1901,34 @@
 N);%0A        
-JDK_TO_LOG4J
+julToLog4j
 .put(java.ut
@@ -1974,28 +1974,26 @@
         
-JDK_TO_LOG4J
+julToLog4j
 .put(jav
@@ -2034,36 +2034,62 @@
 L);%0A        
-LOG4J_TO_JDK
+// Map Log4j to JUL%0A        log4jToJul
 .put(Level.O
@@ -2126,36 +2126,34 @@
 F);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(LevelTr
@@ -2206,36 +2206,34 @@
 T);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.T
@@ -2274,36 +2274,34 @@
 R);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.D
@@ -2341,36 +2341,34 @@
 E);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(LevelTr
@@ -2421,36 +2421,34 @@
 G);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.I
@@ -2487,36 +2487,34 @@
 O);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.W
@@ -2556,36 +2556,34 @@
 G);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.E
@@ -2625,36 +2625,34 @@
 E);%0A        
-LOG4J_TO_JDK
+log4jToJul
 .put(Level.F
@@ -2698,28 +2698,26 @@
         
-LOG4J_TO_JDK
+log4jToJul
 .put(Lev
@@ -2862,20 +2862,18 @@
 urn 
-JDK_TO_LOG4J
+julToLog4j
 .get
@@ -2993,20 +2993,18 @@
 urn 
-LOG4J_TO_JDK
+log4jToJul
 .get

Use lower case ivar names.