I'm trying to convert Log4j Level
to JUL Level
, and would like to use some out-of-the-box utility class. I've found UtilLoggingLevel
, but can't figure out how to use it for this particular case. Any ideas?
An ad hoc solution would be:
private static final ImmutableMap<Level, java.util.logging.Level> LEVELS =
new ImmutableMap.Builder<Level, java.util.logging.Level>()
.put(Level.ALL, java.util.logging.Level.ALL)
.put(Level.DEBUG, java.util.logging.Level.FINE)
.put(Level.ERROR, java.util.logging.Level.SEVERE)
.put(Level.FATAL, java.util.logging.Level.SEVERE)
.put(Level.INFO, java.util.logging.Level.INFO)
.put(Level.OFF, java.util.logging.Level.OFF)
.put(Level.TRACE, java.util.logging.Level.FINEST)
.put(Level.WARN, java.util.logging.Level.WARNING)
.build();
Would be nice to find a standardized function in log4j, if it exists...