@@ -70,19 +70,19 @@ public Object set(@PathVariable String name,
7070 // disabled
7171 return getDisabledResponse ();
7272 }
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 ();
8176 }
8277
8378 private LogLevel getLogLevel (Map <String , String > configuration ) {
8479 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+ }
8686 }
8787
8888 /**
@@ -92,8 +92,8 @@ private LogLevel getLogLevel(Map<String, String> configuration) {
9292 @ ResponseStatus (value = HttpStatus .BAD_REQUEST , reason = "No such log level" )
9393 public static class InvalidLogLevelException extends RuntimeException {
9494
95- public InvalidLogLevelException (String string ) {
96- super (string );
95+ public InvalidLogLevelException (String level ) {
96+ super ("Log level '" + level + "' is invalid" );
9797 }
9898
9999 }
0 commit comments