Commit 6022a27
Brede Fritjof Klausen
[FOR-4925] New annotation, only log response and not request (#9)
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`1 parent 9249e70 commit 6022a27
File tree
4 files changed
+33
-6
lines changed- servicebuilder-core-addons/src/main/java/no/obos/util/servicebuilder/log
- model
- servicebuilder-interfaces/src/main/java/no/obos/util/servicebuilder/annotations
4 files changed
+33
-6
lines changedLines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | 116 | | |
119 | 117 | | |
120 | 118 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
57 | | - | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
68 | | - | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| |||
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments