diff --git a/java/src/org/openqa/selenium/grid/log/LoggingOptions.java b/java/src/org/openqa/selenium/grid/log/LoggingOptions.java index bbe976f9f105f..2ababcb9fe480 100644 --- a/java/src/org/openqa/selenium/grid/log/LoggingOptions.java +++ b/java/src/org/openqa/selenium/grid/log/LoggingOptions.java @@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.Enumeration; +import java.util.List; import java.util.Locale; import java.util.logging.Handler; import java.util.logging.Level; @@ -49,6 +50,17 @@ public class LoggingOptions { private final Config config; private Level level = Level.INFO; public static final String DEFAULT_LOG_TIMESTAMP_FORMAT = "HH:mm:ss.SSS"; + private static final List DEFAULT_LOG_LEVELS = + Arrays.asList( + Level.ALL, + Level.INFO, + Level.CONFIG, + Level.FINE, + Level.FINER, + Level.FINEST, + Level.OFF, + Level.SEVERE, + Level.WARNING); public LoggingOptions(Config config) { this.config = Require.nonNull("Config", config); @@ -76,7 +88,15 @@ public void setLoggingLevel() { try { level = Level.parse(configLevel.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { - throw new ConfigException("Unable to determine log level from " + configLevel); + // Logger is not configured yet + new ConfigException( + "Unable to determine log level from " + + configLevel + + ". Using default " + + DEFAULT_LOG_LEVEL + + ". Available log levels are: " + + DEFAULT_LOG_LEVELS) + .printStackTrace(); } }