Skip to content

Commit d4e3a09

Browse files
committed
[grid] Silent fail on invalid log level
Adding hardcoded log levels as suggested by review.
1 parent c876dce commit d4e3a09

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

java/src/org/openqa/selenium/grid/log/LoggingOptions.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.UnsupportedEncodingException;
2525
import java.util.Arrays;
2626
import java.util.Enumeration;
27+
import java.util.List;
2728
import java.util.Locale;
2829
import java.util.logging.Handler;
2930
import java.util.logging.Level;
@@ -49,6 +50,17 @@ public class LoggingOptions {
4950
private final Config config;
5051
private Level level = Level.INFO;
5152
public static final String DEFAULT_LOG_TIMESTAMP_FORMAT = "HH:mm:ss.SSS";
53+
private static final List<Level> DEFAULT_LOG_LEVELS =
54+
Arrays.asList(
55+
Level.ALL,
56+
Level.INFO,
57+
Level.CONFIG,
58+
Level.FINE,
59+
Level.FINER,
60+
Level.FINEST,
61+
Level.OFF,
62+
Level.SEVERE,
63+
Level.WARNING);
5264

5365
public LoggingOptions(Config config) {
5466
this.config = Require.nonNull("Config", config);
@@ -82,8 +94,8 @@ public void setLoggingLevel() {
8294
+ configLevel
8395
+ ". Using default "
8496
+ DEFAULT_LOG_LEVEL
85-
+ ". Available log levels can be found at"
86-
+ " https://docs.oracle.com/en/java/javase/11/docs/api/java.logging/java/util/logging/Level.html")
97+
+ ". Available log levels are: "
98+
+ DEFAULT_LOG_LEVELS)
8799
.printStackTrace();
88100
}
89101
}

0 commit comments

Comments
 (0)