Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure logs #81

Merged
merged 2 commits into from
Oct 29, 2024
Merged

Restructure logs #81

merged 2 commits into from
Oct 29, 2024

Conversation

ThanKarab
Copy link
Contributor

Beautify logs to fit with elk stack
Add log4j2 log handler to add parameters in the logs through env variables.

New log examples:

2024-10-23 15:39:06.897 - INFO  - org.springframework.web.servlet.DispatcherServlet - [dementia] - [portal-backend] - Initializing Servlet 'dispatcherServlet'
2024-10-23 15:39:06.906 - INFO  - org.springframework.web.servlet.DispatcherServlet - [dementia] - [portal-backend] - Completed initialization in 7 ms
2024-10-23 15:43:01.278 - INFO  - hbp.mip.utils.Logger - [dementia] - [portal-backend] - User -> anonymous , Endpoint -> (POST) /experiments , Info -> Request for experiment creation. RequestBody: {"name":"Descriptive analysis","algorithm":{"name":"descriptive_stats","parameters":[{"name":"dataset","value":"dummy_tbi"},{"name":"filter","value":""},{"name":"pathology","value":"tbi:0.1"},{"name":"y","value":"pupil_reactivity_right_eye_result"}],"preprocessing":null}}
2024-10-23 15:43:01.382 - INFO  - hbp.mip.utils.Logger - [dementia] - [portal-backend] - User -> anonymous , Endpoint -> (POST) /experiments , Info -> Experiment created with id: f4f33da5-f862-4e26-ae58-54953631fc7b
2024-10-23 15:43:01.460 - INFO  - hbp.mip.utils.Logger - [dementia] - [portal-backend] - User -> anonymous , Endpoint -> (GET) /experiments/f4f33da5-f862-4e26-ae58-54953631fc7b , Info -> Request for experiment with id: f4f33da5-f862-4e26-ae58-54953631fc7b

The logger includes prefixes with the service name and the federation, read from env variables.
@ThanKarab ThanKarab merged commit c49be1f into master Oct 29, 2024
1 check passed
@ThanKarab ThanKarab deleted the fix/remove_newline_from_log_messages branch October 29, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants