diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java index e7411d979c..dadc3d1500 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java @@ -132,6 +132,15 @@ class LoggersEndpointWebIntegrationTests { verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); } + @WebEndpointTest + void setLoggerUsingActuatorV3JsonShouldSetLogLevel() { + this.client.post().uri("/actuator/loggers/ROOT") + .contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)) + .bodyValue(Collections.singletonMap("configuredLevel", "debug")).exchange().expectStatus() + .isNoContent(); + verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG); + } + @WebEndpointTest void setLoggerGroupUsingActuatorV2JsonShouldSetLogLevel() { this.client.post().uri("/actuator/loggers/test") @@ -162,7 +171,7 @@ class LoggersEndpointWebIntegrationTests { @WebEndpointTest void setLoggerWithNullLogLevel() { this.client.post().uri("/actuator/loggers/ROOT") - .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)) + .contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)) .bodyValue(Collections.singletonMap("configuredLevel", null)).exchange().expectStatus().isNoContent(); verify(this.loggingSystem).setLogLevel("ROOT", null); } @@ -170,7 +179,7 @@ class LoggersEndpointWebIntegrationTests { @WebEndpointTest void setLoggerWithNoLogLevel() { this.client.post().uri("/actuator/loggers/ROOT") - .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)).bodyValue(Collections.emptyMap()) + .contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)).bodyValue(Collections.emptyMap()) .exchange().expectStatus().isNoContent(); verify(this.loggingSystem).setLogLevel("ROOT", null); } @@ -178,7 +187,7 @@ class LoggersEndpointWebIntegrationTests { @WebEndpointTest void setLoggerGroupWithNullLogLevel() { this.client.post().uri("/actuator/loggers/test") - .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)) + .contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)) .bodyValue(Collections.singletonMap("configuredLevel", null)).exchange().expectStatus().isNoContent(); verify(this.loggingSystem).setLogLevel("test.member1", null); verify(this.loggingSystem).setLogLevel("test.member2", null); @@ -187,7 +196,7 @@ class LoggersEndpointWebIntegrationTests { @WebEndpointTest void setLoggerGroupWithNoLogLevel() { this.client.post().uri("/actuator/loggers/test") - .contentType(MediaType.parseMediaType(ActuatorMediaType.V2_JSON)).bodyValue(Collections.emptyMap()) + .contentType(MediaType.parseMediaType(ActuatorMediaType.V3_JSON)).bodyValue(Collections.emptyMap()) .exchange().expectStatus().isNoContent(); verify(this.loggingSystem).setLogLevel("test.member1", null); verify(this.loggingSystem).setLogLevel("test.member2", null);