spring-bootadminlog-level

Unable to change loglevel with springboot admin


Im looking into a springboot application v2.7.10 and wanted to try the codecentric springboot admin to see if i was able to change loglevel runtime. First i tried the example admin and client which worked fine, but when i transferred the dependencies and settings from the client to my SB application im unable to change the loglevel. I am perfectly able to see the application and its properties.

My application.yml snippet :

spring:
  boot:
    admin:
      client:
        url: http://localhost:8080
        username: admin
        password: admin
        instance:
          metadata:
            user:
              name: ${spring.security.user.name}
              password: ${spring.security.user.password}
  security:
    user:
      name: admin
      password: admin
      roles: admin
  cloud:
    discovery:
      client:
        health-indicator:
          enabled: false

management:
  info:
    env:
      enabled: true
  endpoints:
    enabled-by-default: true
    web:
      base-path: "/monitor"
      exposure:
        include: "*"
      path-mapping:
        health: alive
  endpoint:
    info:
      enabled: true
    health:
      enabled: true
      show-details: always
  health:
    defaults:
      enabled: false

My WebSecurityConfig.java looks like this :

        protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/", "/swagger-ui.html", "/swagger-ui/**", "/openapi/**", "/openapi.yaml").permitAll()
                .antMatchers("/actuator/**").permitAll()
                .antMatchers("/variables.css").permitAll()
                .antMatchers("/monitor/**", "/api/**").permitAll()
                .antMatchers("/example/**").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .and()
                .logout();
    }

So when im looking at localhost:8080 -> wallboard -> application-name -> Loggers and activate a debug button it fails with : "Setting ClassName to debug failed"

Can anyone point out what setting i missed or anything that could fix this ?


Solution

  • Got it working by adding

         .csrf().disable()
    

    to the WebSecurityConfig.java