Comparison with Other Logging Gems

How LogStruct compares with four other Rails logging gems.

FeatureLogStructRails
Semantic
Logger
LogrageLogstasherLogcraft
Core Features
Structured JSON logging
Typed log lines (Sorbet structs), including your own
Works without configuration
Single-line request logs
Multiple output destinations
Colorized console output
Security & Privacy
Filtering sensitive keys in every line
Scrubbing emails, card numbers and tokens inside strings
Security lines (CSRF failures, IP spoofing, blocked hosts)
Integrations
ActiveJob
Sidekiq
GoodJob
ActionMailer
ActiveStorage
CarrierWave and Shrine
ActiveRecord SQL lines
Error reporting (Sentry, Bugsnag, Rollbar, Honeybadger)
Developer Experience
Tags (logger.tagged, config.log_tags)
Terraform provider for CloudWatch metric filters (checks src/evt pairs)

A check means the gem documents or implements the feature, a dash that it partly does (hover over the dash for what's there), and a cross that it doesn't. Checked in October 2026 against each gem's latest release: Rails Semantic Logger 5.2.0 (with Semantic Logger 5.1.0), Lograge 0.15.1, Logstasher 3.0.0 and Logcraft 2.3.

Rails Semantic Logger

Rails Semantic Logger replaces Rails' logger with Semantic Logger, so Rails, the app and gems such as Sidekiq, SolidQueue, Resque, Delayed Job and Mongoid log through it. It turns Rails' request logs into one "Completed" line and has its own log subscribers for ActiveRecord, ActionMailer, ActiveJob and ActionView. Semantic Logger writes on a background thread to any number of appenders (files, STDOUT, Elasticsearch, Splunk, CloudWatch Logs, Sentry, Bugsnag and others), as text, color or JSON. With no configuration it writes text to log/<env>.log, and to STDOUT under rails server. It supports tags and named tags, and has test helpers for Minitest and RSpec. Request params and SQL binds go through Rails' filter_parameters; other values are written as given.

LogStruct writes its lines through Semantic Logger too (the semantic_logger gem, not rails_semantic_logger), with its own JSON formatter. Both replace Rails' logger, so an app uses one or the other. LogStruct writes to STDOUT in production and development, plus Rails' log file in development and test, and adds typed lines, filtering and scrubbing of every line, security lines and error handling modes.

Lograge

Lograge replaces Rails' multi-line request and view logs with one line per request (and one per Action Cable event). The default format is key=value; JSON, Logstash, Graylog2, LTSV and other formatters are options. Other log lines are left as they are. It logs no params unless you add them with custom_options, and it's off until you set config.lograge.enabled = true.

LogStruct depends on Lograge and uses it to build its request lines, which are then filtered and scrubbed like every other line. The Hash a lograge_custom_options proc returns is merged into the request line.

Logstasher

Logstasher writes Logstash JSON events for requests, mailer deliveries, ActiveJob jobs and view renders (and SQL queries, if you turn them on) to its own file, log/logstash_<env>.log by default, or to another logger. The app's own Rails.logger lines stay in Rails' text log. LogStasher.info and the other level methods log the app's own events with tags (its logger's level is WARN unless you set config.logstasher.log_level), and LogStasher.watch adds data from any ActiveSupport notification to the request's event. It's off until you set config.logstasher.enabled = true.

LogStruct writes every line, the app's own included, as JSON (to STDOUT in production), and has Sidekiq, GoodJob, ActiveStorage, CarrierWave and Shrine integrations.

Logcraft

Logcraft sets Rails.logger, and every logger made with Logcraft.logger, to write JSON to STDOUT, without an initializer. It replaces Rails' request logs with one access log line per request, logs unhandled errors on one line, and writes SQL queries as JSON at debug level. within_log_context adds fields to every line logged in a block, and global_context to every line. It includes RSpec matchers for log output. Sidekiq support is a separate gem, logcraft-sidekiq. The README on its main branch describes Logcraft 3, which isn't released yet.

LogStruct also writes JSON to STDOUT in production. It adds typed lines, filtering of every line (not only request params), scrubbing, security lines and integrations for jobs, mailers and file uploads.

What LogStruct Adds

LogStruct builds on Semantic Logger and Lograge, and adds:

  • Typed lines: each integration's lines are Sorbet structs with typed fields, and you can define your own.
  • Filtering: sensitive keys are filtered in every line, not only in request params, using LogStruct's key list and Rails' filter_parameters. Values of email and email_address keys are replaced with a hash.
  • Scrubbing: inside strings, emails are replaced with a hash, and card numbers, phone numbers, SSNs, URL passwords, sensitive URL query params and Bearer and Basic credentials are masked. IP and MAC address scrubbing is opt-in.
  • Security lines: CSRF failures, IP spoofing errors and blocked hosts.
  • Error handling modes: for each kind of error (Sorbet type errors, security errors, LogStruct's own errors and the rest), you choose whether to log it, report it to your error reporter or raise it, or to raise it only in development and test.
  • Integrations: ActiveJob, Sidekiq, GoodJob, ActionMailer, ActiveStorage, CarrierWave, Shrine, SQL queries (opt-in), Puma, Ahoy, ActiveModelSerializers, dotenv-rails, host authorization and Sorbet's error handlers.
  • Terraform provider: it checks src/evt pairs at plan time and builds the CloudWatch filter patterns for metric filters.

What it doesn't do: it has no setting for other log destinations (it writes to STDOUT in production and development, plus Rails' log file in development and test), it's off in development unless you set LOGSTRUCT_ENABLED=true, and it's off in the Rails console.