reidmorrison / rails_semantic_logger

Rails Semantic Logger replaces the Rails default logger with Semantic Logger
https://logger.rocketjob.io/rails
Apache License 2.0
320 stars 114 forks source link

fix: handle nil logger in `ActiveJob::Logging` #189

Closed jschwertfeger closed 10 months ago

jschwertfeger commented 12 months ago

I was getting "undefined method 'tagged' for nil:NilClass (NoMethodError)" exceptions in ActiveJob::Logging as logger was nil. I wasn't sure whether I was not setting up logging correctly so I started out with a vanilla Rails project, created an active job class and raised an exception in it. logger wasn't set there either but ActiveJob handles this case gracefully.

This pull request adds them same handling to the Rails semantic logger.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

jschwertfeger commented 12 months ago

On another note, how would I set up logging so logger is available in active jobs?