collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.82k stars 956 forks source link

Don't log time, logger can be formatted to include time #1149

Open jshah opened 3 years ago

jshah commented 3 years ago

Summary

Including time in logger pollutes loggers that already have a timestamp included. Developers can set their own logger through Delayed::Worker.logger. Additionally, common logging platforms are able to determine time on ingestion such as Cloudwatch, Datadog, Scalyr, etc.

Background

This pr initially included time 10 years ago when Rails didn't support time in logs: https://github.com/collectiveidea/delayed_job/issues/37. 5 years later, this issue was opened asking for the same fix https://github.com/collectiveidea/delayed_job/pull/859 but Rails still did not support it. Now, this is possible with Rails loggers using your own logger and setting Rails.logger.datetime_format to your own desired format, see https://stackify.com/rails-logger-and-rails-logging-best-practices/ for examples/tutorial.

jshah commented 3 years ago

@albus522 have time to review?