Require a class attribute in structured application logs

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

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 Jul 21, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading