Skip to content

Conversation

@BredeFK
Copy link
Contributor

@BredeFK BredeFK commented Aug 13, 2024

To cut down on number of logs, only the response should be logged and not the request.
Normally for every request there will be two logs, one for request that will inform about the method, context-path and potential request-body, and one identical but with response, millis and entity. We only need the latter log if it's a GET request.

Task

https://obos-bbl.atlassian.net/browse/FOR-4925

Changes

  • Add new annotation @LogOnlyResponse
    • Default is set to false
    • Will only log the response and not the request when set to true

Example

To use it you have to set LogOnlyResponse to true like this @LogOnlyResponse(true) or like this @LogOnlyResponse(value = true)

Without the annotation

2024-08-14 09:41:43,628 INFO [0fe1aef1-81b8-1337-hello-0021a8dff2fd] n.o.u.s.client.ClientLogFilter GET http://app.obos.no/bolig/v4/api/selskap/1445/organisasjonsnumre
2024-08-14 09:41:43,646 INFO [0fe1aef1-81b8-1337-hello-0021a8dff2fd] n.o.u.s.client.ClientLogFilter GET http://app.obos.no/bolig/v4/api/selskap/1445/organisasjonsnumre response: 200, millis: 18

With the annotation

2024-08-14 09:41:43,646 INFO [0fe1aef1-81b8-1337-hello-0021a8dff2fd] n.o.u.s.client.ClientLogFilter GET http://app.obos.no/bolig/v4/api/selskap/1445/organisasjonsnumre response: 200, millis: 18

@BredeFK BredeFK marked this pull request as ready for review August 14, 2024 07:47
Copy link

@koderjohannes koderjohannes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@BredeFK BredeFK merged commit 6022a27 into develop Aug 14, 2024
@BredeFK BredeFK deleted the feature/FOR-4925 branch August 14, 2024 09:36
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.

3 participants