Skip to content

Add log_rpc option to suppress noisy per-request RPC trace logs#5

Open
noah44846 wants to merge 1 commit intoanycable:mainfrom
noah44846:main
Open

Add log_rpc option to suppress noisy per-request RPC trace logs#5
noah44846 wants to merge 1 commit intoanycable:mainfrom
noah44846:main

Conversation

@noah44846
Copy link
Copy Markdown

Summary

Hey!

When debugging a Rails app with AnyCable, I noticed that every incoming HTTP RPC call (connect/command/disconnect) gets logged with the full request payload — including long session tokens, cookies, and serialized connection data. This makes the Rails log very hard to read when you're trying to follow your application logic, since the RPC trace lines are verbose and repeat information ActionCable already logs in a more readable form.

The root cause is that anycable-rails replaces AnyCable.logger with Rails.logger, so the existing log_level and log_file config options have no effect — you'd have to lower the log level for your entire Rails app to get rid of the noise, which is not acceptable in my case.

This adds a log_rpc config option (default: true) to opt out of per-request RPC trace logs while keeping everything else — including errors — untouched. Follows the same pattern as the existing log_grpc option.

Changes

  • Add log_rpc config option (default: true) — set to false to suppress per-request info/debug trace logs in RPC handlers (connect/command/disconnect) and the HTTP broadcast adapter (enqueue/perform). Errors are unaffected.

Checklist

  • I've added tests for this change — skipped, no existing test pattern for log option behavior in this codebase
  • I've added a Changelog entry
  • I've updated documentation

Usage:

# anycable.yml
development:
  log_rpc: false

When used with anycable-rails, AnyCable's logger gets replaced by the Rails logger, making log_level/log_file config ineffective for filtering RPC-specific noise. Add log_rpc (default: true) to suppress the per-request trace logs (connect/command/disconnect and broadcast enqueue/perform) while still surfacing errors. Follows the same pattern as log_grpc.
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

Successfully merging this pull request may close these issues.

1 participant