Skip to content

Conversation

@bluzky
Copy link

@bluzky bluzky commented Aug 22, 2024

Hi,

I think it would be helpful to add job id to Logger metadata. So it would provide better log tracebility.

For example:

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:job_id]

produce log
13:13:00.120 job_id=8a762129-beff-4a2e-b9f6-35d1a1067581 [info] Time calculate pending orders - 0

and we can find all log that belongs to the same job

How do you think.

@ananthakumaran
Copy link
Collaborator

Couple of things to do

  1. rename it to jid, which is what we use everywhere
  2. do the same on Exq.Middleware.Logger as well in the before_work, so all the logs from exq logger will also have the correct jid and would be useful to filter out the logs of a single job with structured logging

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.

2 participants