Skip to content
This repository

HTTPS clone URL

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…

Octocat-spinner-32-eaf2f5

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
Readme.rdoc

AMQPLogging

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 => AppConfig.amqp_logging.host,
                   :exchange => AppConfig.amqp_logging.exchange }

logger = AMQPLogging::Logger.new(logging_config)
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.

Example:

# 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 = "logs.app.#{$1}"
    key << ".statistics" unless $2.nil?
  else
    key = "logs.app.system"
  end
  key
end

AMQPLogging::Logger.new($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.

License

Copyright © 2010 Pascal Friederich Copyright © 2010 XING AG

See LICENSES for details.

Something went wrong with that request. Please try again.