-
-
Notifications
You must be signed in to change notification settings - Fork 209
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 constant like GoodJob.within_cli?
to improve configuration of annoying ActiveRecord logging
#127
Comments
I think you’re experiencing Rails’s verbose query logging: https://guides.rubyonrails.org/debugging_rails_applications.html#verbose-query-logs Verbose query logs are turned on by default in development, and (I think) off in production. I agree, it’s annoying; it also shows up when running in There are a couple different approaches one could take:
|
As it goes for I guess having something like |
@morgoth whoops, you're correct about Thinking more about it, it does straddle the line of Rails configuration and GoodJob. Query logging is an implicit feature of Rails and the Rails logger... and GoodJob is unexpectedly verbose just given that it has to poll on a regular basis. Your workaround is similar to what I have in my Rails projects: # config/environments/{development.rb|production.rb}
config.log_level = ENV.fetch("RAILS_LOGGER_LEVEL", "info") I'll transform this Issue into a feature request for a constant for checking whether configuration is running as part of GoodJob. # config/initializers/good_job.rb
if GoodJob.within_cli?
Rails.application.config.log_level = ENV.fetch("RAILS_LOGGER_LEVEL", "info")
end |
GoodJob.within_cli?
to improve configuration of annoying ActiveRecord logging
As mentioned above you can also raise the polling duration to keep the dev log from getting huge: e.g. 1 minute.
@bensheldon states that polling can be shut off by setting the interval to
|
Revisiting this, there is a method to test whether the current process is running as part of the GoodJob::CLI.within_exe? |
When using newly generated Rails app, which sets by default log level to "DEBUG", the worker process outputs annoying AR logging every second:
which creates a lot of noise.
I disabled it by:
and then in Procfile (or whenever the worker is run):
worker: RAILS_LOGGER_LEVEL="info" bundle exec good_job start
Not sure if this could somehow be integrated into gem itself by some configuration accessor, as this is an issue with global ActiveRecord logging so in fact it is out of scope of GoodJob gem.
If there is no clever way to do it, maybe a mention in doscs how to workaround it would be useful.
The text was updated successfully, but these errors were encountered: