Repository navigation
Depend on railties instead of rails, support SolidQueue job IDs, and write STDOUT unbuffered - #19
Merged
Merged
Conversation
Active Job backends set provider_job_id to a String or an Integer; SolidQueue uses the ID of its job row. The log subscriber passed it straight into a T.nilable(String) field, so every job event raised a TypeError under SolidQueue. Builders::ActiveJob had the same bug, but nothing requires or calls it, so it's removed rather than fixed. Fixes #7
LogStruct only needs railties for its Railtie, actionpack for its middleware and request logs, activesupport and globalid. Depending on the rails gem pulled Active Record, Active Storage, Action Cable and the other frameworks into apps that don't use them. The integrations for those frameworks already load only when the framework is present; the formatter's Active Record check no longer assumes it is. A new CI job boots an app whose bundle has railties and actionpack but none of the other frameworks, and checks that it logs JSON app and request lines. Fixes #9
Ruby buffers STDOUT when it isn't a terminal, as in a container, so log lines waited until the buffer filled or the process exited, and a crash lost them. Puma and Sidekiq sync STDOUT themselves, but GoodJob's executable only does when it adds its own text logger. The STDOUT appender now syncs STDOUT.
LogStruct added a file appender whenever Rails had a log path, so with RAILS_LOG_TO_STDOUT set every line was written to STDOUT and to log/<env>.log as well. In a container nothing reads or rotates that file, so it only grew. RAILS_LOG_TO_STDOUT now means STDOUT only, as it does for Rails' own logger.
|
Warning Review limit reached
This review includes 9 billable files and costs up to $2.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 37 minutes for your next included review. View limit details
Comment |
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth of twelve stacked PRs for 0.2.0.
What this fixes
provider_job_idcan be an Integer; it's now logged as a String. The unusedBuilders::ActiveJob, which had the same bug, is removed.railties,actionpack,activesupport,globalidandlogrageinstead ofrails(Rails dependency likely not needed #9, thanks @langalex for the issue and Change rails to railties dependency #10), so apps no longer install every Rails framework to use it. A new CI job boots an app with only railties and actionpack and checks it logs JSON.RAILS_LOG_TO_STDOUTset, LogStruct writes only to STDOUT, not also tolog/<env>.log.Addresses #7 and #9.
Testing
Sorbet and the unit suite (303 tests) pass at this branch's tip. CI's new job boots an app with only railties and actionpack.
Stack for 0.2.0, merged in order: #16 → #17 → #18 → #19 → #20 → #21 → #22 → #23 → #24 → #25 → #26 → #27