Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convenience method for delayed Rails startup logging #4

Open
dmolesUC opened this issue Aug 1, 2022 · 0 comments
Open

Add convenience method for delayed Rails startup logging #4

dmolesUC opened this issue Aug 1, 2022 · 0 comments

Comments

@dmolesUC
Copy link
Contributor

dmolesUC commented Aug 1, 2022

Logging early in the Rails startup sequence (e.g. in application.rb or in one of the files under config/environments) can fail due to the logger not being initialized. In this situation the workaround is to wrap the call to the logger in a config.after_initialize block:

config.after_initialize do
  Rails.logger.info('msg', obj)
end

It would be nice to have a convenience object or set of convenience methods that would DRY this and keep the complexity out of the config/initialization files.

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

No branches or pull requests

1 participant