0.01
No commit activity in last 3 years
No release in over 3 years
A ruby logger class that logs to an AMQP exchange in addition to your default log device.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.6.0
>= 1.4.0
 Project Readme

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.