-
-
Notifications
You must be signed in to change notification settings - Fork 125
ActiveJob[+SolidQueue?] job's code log stream broken (with hacky workaround) #237
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Any addition insights to resolve this issue at all? |
Does someone in the community that uses Active Job have a solution they want to submit as a PR? |
2 small cents from me. |
This is really painful. I basically have to use sync in the jobs :( |
I'm also not able to get SolidQueue logs to go to AppSignal. And the |
I am also facing the same issue and have used miharekar/visualizer@065b009 as a workaround. |
I had another look at this and think I might have figured out a solution. I remembered from configuring Puma it was required to call
~ https://github.com/reidmorrison/semantic_logger/blob/master/docs/forking.md#process-forking Reading through the Solid Queue docs it says:
~ https://github.com/rails/solid_queue?tab=readme-ov-file#workers-dispatchers-and-scheduler It also offers four hooks SolidQueue.on_start
SolidQueue.on_stop
SolidQueue.on_worker_start
SolidQueue.on_worker_stop ~ https://github.com/rails/solid_queue?tab=readme-ov-file#lifecycle-hooks So I found that by adding # config/initializers/solid_queue.rb
SolidQueue.on_worker_start do
# Re-open appenders after forking the process
SemanticLogger.reopen
end The logs have started to appear in STDOUT. |
Environment
Provide at least:
Rails configuration:
Expected Behavior
Log to $stdout
Actual Behavior
I've been using SM for many years, and that's the first time I have issues, and I think they come from SolidQueue thread model or something.
Ok, the problem is SM prints only part of logs: from SolidQueue (supervisor?) but not from the job processing code.
My job class:
Log dump:
This code works, but that is not what we all want :)
After some time of double-checking everything I found workaround: an attempt to re-add $stdout appender resets something, and fix logging:
The log message about this dirty hack appears, but at least this works :)
There's even worse hack: call
SemanticLogger#sync!
.Thank you for your work!
The text was updated successfully, but these errors were encountered: