Commit e2a1252
authored
Use JSON-format structured logging in production (#882)
## Status
- Related to
RaspberryPiFoundation/digital-editor-issues#1455
## What's changed?
- Adds the Semantic Logging gem and uses it to make log messages more
useful. See a comparison
[here](https://logger.rocketjob.io/rails.html#configuration).
- This includes controller and action names by default.
- In the production environment only, logs are structured in JSON-format
to make filtering easier in BetterStack.
- Example: [filtering down to GET requests on the
FeaturesController](https://telemetry.betterstack.com/team/t62404/tail?s=l314881&q=message.payload.controller%3D%22Api%3A%3AFeaturesController%22%20message.payload.method%3D%22GET%22&a=1781695637116522.107740926).
- _The change in `application.rb` looks like it also enables JSON
logging in non-prod environments, however this only applies to the log
files written to disk, not the logging output in standard out._
- Disables Flipper logging, which was at DEBUG level with no clear way
of changing the level.
## Steps to perform after deploying to production
None.1 parent 7fdca65 commit e2a1252
5 files changed
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
| |||
513 | 517 | | |
514 | 518 | | |
515 | 519 | | |
| 520 | + | |
| 521 | + | |
516 | 522 | | |
517 | 523 | | |
518 | 524 | | |
| |||
618 | 624 | | |
619 | 625 | | |
620 | 626 | | |
| 627 | + | |
621 | 628 | | |
622 | 629 | | |
623 | 630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
0 commit comments