DEV.co
Open-Source Observability · reidmorrison

semantic_logger

Semantic Logger is a structured, asynchronous logging framework for Ruby and Rails that preserves searchable data (hashes, exceptions, metrics) instead of flattening logs to text. It uses a background thread to queue and write logs without blocking the application, supporting dozens of destinations from Elasticsearch to Splunk to Syslog.

Source: GitHub — github.com/reidmorrison/semantic_logger
955
GitHub stars
138
Forks
Ruby
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryreidmorrison/semantic_logger
Ownerreidmorrison
Primary languageRuby
LicenseApache-2.0 — OSI-approved
Stars955
Forks138
Open issues0
Latest releaseUnknown
Last updated2026-07-08
Sourcehttps://github.com/reidmorrison/semantic_logger

What semantic_logger is

A high-performance Ruby gem providing asynchronous structured logging with in-memory queueing, multiple appender outputs (file, ElasticSearch, Graylog, Sentry, OpenTelemetry, etc.), and optional dependencies for specialized integrations. Logs are preserved as structured data through the entire pipeline, enabling downstream searching and analytics.

Quickstart

Get the semantic_logger source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/reidmorrison/semantic_logger.gitcd semantic_logger# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Rails Applications with Centralized Log Aggregation

Replace Rails' default logger with Semantic Logger (via rails_semantic_logger gem) to send structured logs to Elasticsearch/Kibana, Splunk, or Datadog without blocking request processing. Metrics, durations, and exception context remain searchable.

Background Job and Batch Processing Monitoring

Pair with Rocket Job to log job metrics asynchronously. Measure block execution times, capture result hashes, and forward metrics to dashboards via OpenTelemetry or NewRelic appenders without slowing batch operations.

Multi-Destination Error Tracking and Observability

Log exceptions and structured payloads simultaneously to Sentry/Honeybadger, CloudWatch, and BugSnag with a single logger call. Asynchronous delivery ensures error reporting does not impact application latency.

Implementation considerations

  • Asynchronous queueing trades latency for throughput; in resource-constrained environments (e.g., Lambda, containers with tight memory), monitor queue depth and appender thread behavior.
  • Optional dependencies (Elasticsearch, Splunk, MongoDB, Sentry gems) must be manually included; ensure your Gemfile declares them only if those appenders are used.
  • When running Rails, use rails_semantic_logger gem instead of semantic_logger directly to avoid conflicts with Rails' logger initialization.
  • Background thread may not flush logs on abrupt process termination (kill -9); configure graceful shutdown hooks if durability on exit is critical.
  • Performance scales well for thousands of logs/sec; test queue backlog behavior under peak load and monitor appender thread for blocking I/O or network latency.

When to avoid it — and what to weigh

  • Non-Ruby/Rails Ecosystems — Semantic Logger is Ruby-specific. If your stack is Python, Go, Node.js, or .NET, choose language-native logging libraries (e.g., Loguru, Zap, Winston, Serilog).
  • Minimal Logging Requirements — If you only need basic text logging to stdout or a single file with no structured data or integrations, Ruby's built-in Logger or Rails' default logger will suffice; Semantic Logger adds overhead and complexity.
  • Strict Synchronous Logging Guarantees — Semantic Logger's asynchronous queueing means log delivery is not guaranteed on immediate shutdown or OOM. If you require synchronous, blocking writes with absolute durability guarantees, configure appenders explicitly or use a blocking mode.
  • Enterprise License or Support Requirements — Semantic Logger is Apache 2.0 licensed with no commercial support entity. If your organization requires vendor-backed SLAs, professional indemnity, or proprietary terms, evaluate commercial alternatives.

License & commercial use

Apache License 2.0 (Apache-2.0). This is a permissive OSI-approved license permitting commercial use, modification, and distribution with attribution and liability/warranty disclaimers.

Apache 2.0 explicitly permits commercial use without royalties or licensing fees. However, no vendor provides commercial support, SLAs, or indemnification. Organizations requiring enterprise support, liability insurance, or vendor indemnity should clarify expectations with legal counsel and plan for community-only support.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

Semantic Logger itself provides no special hardening. Risks: (1) In-memory queue may expose sensitive payloads in memory dumps; sanitize or redact PII before logging. (2) Async delivery on shutdown may lose logs in crash scenarios; validate critical audit logs are persisted. (3) Appender credentials (e.g., API keys for Sentry, BugSnag) must be stored securely via environment variables or secrets management, not hardcoded. (4) Ensure appender destinations (HTTP, TCP, Elasticsearch) use TLS and validate certificates. No known CVEs listed; auditing appender dependency updates is recommended.

Alternatives to consider

Ruby's Built-in Logger or Rails Default Logger

If you need simple text-only logging without structured data, integration overhead, or background threading. Suitable for small apps or development; lacks performance and observability features.

Lograge (Rails-specific)

Lightweight Rails request logging with JSON output. Good for single-appender, request-scoped logging; lacks semantic structure for application-level events, exception context, or multiple simultaneous destinations.

Loki (Grafana) + Promtail

Cloud-native log aggregation for multi-language stacks. Requires separate infrastructure; suited for Kubernetes and observability platforms. Less suitable for structured payloads within Ruby; requires external parsing.

Software development agency

Build on semantic_logger with DEV.co software developers

Evaluate Semantic Logger in a staging environment. Test appender integrations, monitor queue performance under load, and compare latency gains vs. your current logger. Contact us to discuss multi-destination observability strategies.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

semantic_logger FAQ

Will Semantic Logger slow down my Rails app?
No; logs are pushed to an in-memory queue and handled by a separate background thread. Your request is not blocked. Throughput can exceed 1000s logs/sec. Caveat: if the queue fills faster than the appender can flush, latency increases; monitor queue depth under load.
Do I need to install all optional dependencies?
No. Optional gems (Elasticsearch, Splunk, Sentry, MongoDB, etc.) are only required if you use the corresponding appender. Include them in Gemfile only if needed. Semantic Logger core has minimal dependencies.
How do I integrate Semantic Logger with Rails?
Use the rails_semantic_logger gem, not semantic_logger directly. It auto-replaces Rails' default logger. Add to Gemfile, bundle, and configure via config/initializers/semantic_logger.rb or config/semantic_logger.yml.
What happens to logs if the app crashes or shuts down abruptly?
Logs in the async queue may be lost if the app is killed (kill -9) before the background thread flushes. For critical audit logs, configure synchronous mode or persistence. Graceful shutdown (SIGTERM) allows time to flush before exit.

Custom software development services

DEV.co helps companies turn open-source tools like semantic_logger into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source observability stack.

Ready to upgrade your Rails logging?

Evaluate Semantic Logger in a staging environment. Test appender integrations, monitor queue performance under load, and compare latency gains vs. your current logger. Contact us to discuss multi-destination observability strategies.