@ Route ( method = HttpMethod . PUT , uri = "/monitor/logs/{name}" ) public Result setLevel ( @ Parameter ( "name" ) String loggerName , @ Parameter ( "level" ) String level ) { LoggerContext context = ( LoggerContext ) LoggerFactory . getILoggerFactory ( ) ; Logger logger = context . getLogger ( loggerName ) ; if ( logger != null ) { logger ( ) . info ( "Setting the log level of {} to {}" , loggerName , level ) ; ( ( ch . qos . logback . classic . Logger ) logger ) . setLevel ( Level . toLevel ( level ) ) ; return loggers ( ) ; } else { logger ( ) . warn ( "Cannot set the level of logger {} - the logger does not exist" , loggerName ) ; return notFound ( ) ; } }
Changes the log level of the specified logger .