InseeFrLab / onyxia-api

REST API of Onyxia
https://onyxia.sh
MIT License
24 stars 29 forks source link

Add support for logging in json or other structured format #496

Closed johnksv closed 1 week ago

johnksv commented 2 months ago

This will increase observability of the logs when using external logging explorer tools P.t. the default spring log format is used: e.g. 2024-09-17T10:32:03.991Z INFO 7 --- [ main] fr.insee.onyxia.api.Application : No active profile set, falling back to 1 default profile: "default"

Proposal, something like:

{
"timestamp": "2024-09-17T10:32:03.991Z"
"process_id": 7
"thread": "main"
"log_level": "INFO"
"logger_name": "fr.insee.onyxia.api.Application"
"message": "No active profile set, falling back to 1 default profile: \"default\"`"
}
olevitt commented 2 months ago

Hi !

I'm all in favor for this ! After doing some research, I found this : https://spring.io/blog/2024/08/23/structured-logging-in-spring-boot-3-4
Structured logging is coming to spring boot in the next version.
So I suggest we wait a few weeks (should not be long now, spring has already released 2 MC versions).

olevitt commented 2 months ago

Hi !

I'm all in favor for this ! After doing some research, I found this : https://spring.io/blog/2024/08/23/structured-logging-in-spring-boot-3-4 Structured logging is coming to spring boot in the next version. So I suggest we wait a few weeks (should not be long now, spring has already released 2 MC versions).

According to https://calendar.spring.io/ it's due to release on november 21. Hope that's okay with you @johnksv. We will make sure to implement the structured logging shortly after the release.