Ruby logging support for
Pull request Compare This branch is 131 commits behind logentries:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Logging to Logentries in Ruby

This is a Logentries library for logging from Ruby platforms, including Heroku.

It is available on github and rubygems

Example"information message")
Rails.logger.warn("warning message")
Rails.logger.debug("debug message")


You must first register your account details with Logentries.

Once you have logged in to Logentries, create a new host with a name of your choice. Inside this host, create a new logfile, selecting Token TCP as the source type.


To install the gem you must edit the Gemfile in your local heroku environment

Add the following line:

gem 'le', '2.0'

Then from the cmd line run the following command:

bundle install

This will install the gem on your local environment.

The next step is to configure the default rails logger to use the logentries logger.

In your config/environment.rb file, add the following:

if Rails.env.development?
    Rails.logger ='LOGENTRIES_TOKEN', true)
    Rails.logger ='LOGENTRIES_TOKEN')

This will set the rails logger to use the Logentries logger in production and log to the console in development environment.

For the LOGENTRIES_TOKEN argument, paste the token for the logfile you created earlier in the Logentries UI.

Now, simply use"message") inside your code to send logs to Logentries