exq
exq copied to clipboard
Add job_id to Logger metadata for tracing
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.
Couple of things to do
- rename it to
jid, which is what we use everywhere - do the same on
Exq.Middleware.Loggeras well in thebefore_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