@@ -70,19 +70,19 @@ public Object set(@PathVariable String name,
70
70
// disabled
71
71
return getDisabledResponse ();
72
72
}
73
- try {
74
- LogLevel logLevel = getLogLevel (configuration );
75
- this .delegate .setLogLevel (name , logLevel );
76
- return ResponseEntity .ok ().build ();
77
- }
78
- catch (IllegalArgumentException ex ) {
79
- throw new InvalidLogLevelException ("No such log level " + configuration .get ("configuredLevel" ));
80
- }
73
+ LogLevel logLevel = getLogLevel (configuration );
74
+ this .delegate .setLogLevel (name , logLevel );
75
+ return ResponseEntity .ok ().build ();
81
76
}
82
77
83
78
private LogLevel getLogLevel (Map <String , String > configuration ) {
84
79
String level = configuration .get ("configuredLevel" );
85
- return (level == null ? null : LogLevel .valueOf (level .toUpperCase ()));
80
+ try {
81
+ return (level == null ? null : LogLevel .valueOf (level .toUpperCase ()));
82
+ }
83
+ catch (IllegalArgumentException ex ) {
84
+ throw new InvalidLogLevelException (level );
85
+ }
86
86
}
87
87
88
88
/**
@@ -92,8 +92,8 @@ private LogLevel getLogLevel(Map<String, String> configuration) {
92
92
@ ResponseStatus (value = HttpStatus .BAD_REQUEST , reason = "No such log level" )
93
93
public static class InvalidLogLevelException extends RuntimeException {
94
94
95
- public InvalidLogLevelException (String string ) {
96
- super (string );
95
+ public InvalidLogLevelException (String level ) {
96
+ super ("Log level '" + level + "' is invalid" );
97
97
}
98
98
99
99
}
0 commit comments