JavaLoggingSystem.getLoggerConfiguration does not map ROOT and creates unknown loggers on lookup
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java, spring-boot
- Área
- backend, observability
Línea de trabajo
Empieza con JavaLoggingSystem#getLoggerConfiguration y compara la búsqueda de logger con la asignación del nombre raíz en setLogLevel. Revisa en JavaLoggingSystemTests si hay cobertura para las búsquedas de loggers raíz y desconocidos, y luego ejecuta esos tests. Se considera terminado cuando ROOT devuelve el nivel configurado y un logger desconocido se notifica como inexistente sin registrarlo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
When JavaLoggingSystem is used, getLoggerConfiguration(String) behaves differently from setLogLevel and from the Logback and Log4j2 implementations:
ROOTis not mapped to the JUL root logger""(setLogLeveldoes this mapping), so the lookup returns a child logger literally namedROOT.Logger.getLogger(name)creates the logger on demand and never returnsnull, so an unknown logger is never reported as missing.
As a result, the loggers actuator endpoint behaves inconsistently with JUL:
Spring Boot 4.1.2, -Dorg.springframework.boot.logging.LoggingSystem=org.springframework.boot.logging.java.JavaLoggingSystem, management.endpoints.web.exposure.include=loggers:
POST /actuator/loggers/ROOT {"configuredLevel":"DEBUG"} -> 204
GET /actuator/loggers/ROOT -> 200 {"effectiveLevel":"DEBUG"} // configuredLevel missing
GET /actuator/loggers/no.such.logger -> 200 {"effectiveLevel":"DEBUG"} // Logback/Log4j2 return 404
GET /actuator/loggers does list ROOT with configuredLevel: DEBUG, because there the name "" comes from LogManager, so the single-logger and all-loggers views disagree. Each lookup of an unknown name also permanently registers a new JUL logger.
Expected (same as with Logback/Log4j2):
GET /actuator/loggers/ROOT -> 200 {"configuredLevel":"DEBUG","effectiveLevel":"DEBUG"}
GET /actuator/loggers/no.such.logger -> 404
The relevant code is JavaLoggingSystem#getLoggerConfiguration (unchanged since 2016). Commit 1d2f6d25fa ("Use consistent 'ROOT' logger name") aligned setLogLevel only. A minimal change that fixes both points:
if (ROOT_LOGGER_NAME.equals(loggerName)) {
loggerName = "";
}
Logger logger = LogManager.getLogManager().getLogger(loggerName);
I verified this with an end-to-end test (@SpringBootTest(webEnvironment = RANDOM_PORT) plus real HTTP calls) against 4.1.2 (fails) and against a locally built spring-boot jar with the change above (passes). The existing JavaLoggingSystemTests also still pass. I'm happy to share the sample or submit a PR with tests if that's useful.
- Lenguaje dominante
- Java
- Estrellas
- 81.8k
- Forks
- 43.5k
- Merge medio
- 3 d 13 h
- PR fusionados (30 d)
- 90
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de spring-projects/spring-boot
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
spring-projects/spring-boot#52651 ·
Los mantenedores suelen responder en 2 días
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
spring-projects/spring-boot#52647 ·
Los mantenedores suelen responder en 2 días
-
Maven process-test-aot only copies META-INF/native-image of the generated resources so the Logback configuration is lost in native testsPosiblemente ocupada @tchowdhury101 la tomó hace 4 días. Abiertotype: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
spring-projects/spring-boot#52301 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
for: team-meeting status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
spring-projects/spring-boot#52295 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
Add a How-To to explain how to configure logging of AOT processingQuizá libre de nuevo @dana-stc la tomó hace 30 días y no hay ningún pull request abierto. Abiertostatus: team-only type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
spring-projects/spring-boot#52092 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de spring-projects/spring-boot
Issues similares
-
hermes-queue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
chrisalunlloyd2-sudo/mindpalace#349 ·
Los mantenedores suelen responder en 1 día
-
bug priority: medium Review effort [1-5]: 2 status: needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
carlos-emr/carlos#5818 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue help wanted tooling
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
appmonster007/kmip-adapter#100 ·
-
[Documentation]: Remove non-existent CHANGELOG reference from StateBackendProperties JavadocAbiertoaccepted good first issue java
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Marketplace time-zone issueAbiertobug main ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openhab/openhab-webui#4671 ·
Los mantenedores suelen responder en 1 día