Next generation logging system for Ruby to support highly concurrent, high throughput, low latency systems
Ruby
Latest commit f5e7d10 Feb 6, 2017 @reidmorrison reidmorrison v4.0.0.rc1

README.md

semantic_logger

Gem Version Build Status Downloads License Gitter chat

Low latency, high throughput, enterprise-scale logging system for Ruby

Documentation

Semantic Logger Guide

Reference Documentation

Logging Destinations

Logging to the following destinations are all supported "out-of-the-box":

  • File
  • Screen
  • MongoDB
  • BugSnag
  • NewRelic
  • Splunk
  • Syslog
  • Roll-your-own

Semantic Logger is capable of logging thousands of lines per second without slowing down the application. Traditional logging systems make the application wait while the log information is being saved. Semantic Logger avoids this slowdown by pushing log events to an in-memory queue that is serviced by a separate thread that only handles saving log information to multiple destinations at the same time.

Rails

When running Rails, use rails_semantic_logger instead of Semantic Logger directly since it will automatically replace the Rails default logger with Semantic Logger.

Supports

Semantic Logger is tested and supported on the following Ruby platforms:

  • Ruby 2.1, 2.2, 2.3, and above
  • JRuby 1.7.23, 9.0.5 and above

The following gems are only required when their corresponding appenders are being used, and are therefore not automatically included by this gem:

  • Bugsnag Appender: gem 'bugsnag'
  • MongoDB Appender: gem 'mongo' 1.9.2 or above
  • NewRelic Appender: gem 'newrelic_rpm'
  • Syslog Appender: gem 'syslog_protocol' 0.9.2 or above
  • Syslog Appender to a remote syslogng server over TCP or UDP: gem 'net_tcp_client'
  • Splunk Appender: gem 'splunk-sdk-ruby'

V4 Upgrade notes

The following changes need to be made when upgrading to V4:

  • Ruby V2.1 / JRuby V9.1 is now the minimum runtime version.
  • Replace calls to Logger#with_payload with SemanticLogger.named_tagged.
  • Replace calls to Logger#payload with SemanticLogger.named_tags.
  • Appenders now write payload data in a seperate :payload tag instead of mixing them. directly into the root elements to avoid name clashes.
  • MongoDB Appender requires Mongo Ruby Client V2 or greater.

Install

gem install semantic_logger

To configure a stand-alone application for Semantic Logger:

require 'semantic_logger'

# Set the global default log level
SemanticLogger.default_level = :trace

# Log to a file, and use the colorized formatter
SemanticLogger.add_appender(file_name: 'development.log', formatter: :color)

If running rails, see: Semantic Logger Rails

Author

Reid Morrison

Contributors

Versioning

This project uses Semantic Versioning.