Require a `class` attribute in structured application logs
Description
In various places in code we either call AppJsonLogger
or Gitlab::AppLogger
that under the hood is using structured logging:
$ ag 'AppJsonLogger|AppLogger' -l | wc -l
309
It is sometimes challenging to find all entries that are getting logged from a particular place in the code. Sometimes we need to match for a message, sometimes the message changes depending on what is getting logged.
Proposal
Make it required to pass class
attribute to the structured logger to make it available as json.class
in Elastic.
Alternatively we can try to extract some information into json.caller
in an automated way, but explicit class
might be better.
/cc @stanhu
Edited by Grzegorz Bizon