Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A ruby logger for logging via an AMQP exchange

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENCES
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.rdoc
Octocat-spinner-32 amqp_logging.gemspec


A ruby logger class that logs to an AMQP exchange

Basic Configuration

By default the logs are routed to the host, exchange and key specified in DEFAULT_OPTIONS. You can change the configuration when creating the logger object by specifying an argument hash:

require 'amqp_logging'

logging_config = { :routing_key => "applogging",
                   :host =>,
                   :exchange => }

logger =
config.logger = logger

Routing Keys

You can set the routing key with a string or use a generator that respondes to call, receives the logline as the first argument and returns the routing key.


# You can use a lambda or whatever responds to #call as the routing key generator
AMQPRoutingKeyGenerator = lambda do |logline|
  if logline =~ /(?:engine\[([^\]]*)\])\: (Completed in|Processing|Session ID)?/
    key = "{$1}"
    key << ".statistics" unless $2.nil?
    key = ""
end$stdout, :routing_key => AMQPRoutingKeyGenerator)

Fallback to disk

The support for a fallback logdevice was removed with version 0.5.0. A multi logger thatallows you get the same behaviour will follow soonish.


Copyright © 2010 Pascal Friederich Copyright © 2010 XING AG

See LICENSES for details.

Something went wrong with that request. Please try again.