1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
@RestController public class HotModificationLevel { private final LoggingSystem loggingSystem; public HotModificationLevel(LoggingSystem loggingSystem) { this.loggingSystem = loggingSystem; } @PostMapping("/logger/level") public void setLoggerLevel(@RequestBody SetLoggerLevelParam levelParam) { loggingSystem.setLogLevel(levelParam.getLoggerName(), levelParam.getLoggerLevel()); } public static class SetLoggerLevelParam { private String loggerName; private LogLevel loggerLevel; // 省略getter和setter } } |
参考:https://juejin.cn/post/7348309454700183561