Rack middleware to sit in a rails app to put put the current environments log to a webpage. eg /logput
To be used in test and development environments to see logs without needing direct access to the box.
⚠️ This is NOT to be used in production like environments.
Supports Rails 3.x.x and 4.x.x
- Phil Lee (@asmega) [Author]
- Chris Barber (@chrisbarber86)
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install logput
Inside you rails app. Add the following line to config/development.rb and/or any other environment you wish to use this in.
The following configuration options are available.
:path_to_log_file => '/path/to/custom/log'. Defaults to current environments log file if in rails.
:lines_to_read => 1000. Defaults to 500.
config.middleware.use(Logput::Middleware, :lines_to_read => 300, :path_to_log_file => './log/delayed_job')
Start your rails server as normal in the set environment. Navigate to /logput e.g. http://localhost:3000/logput
Environment Variable Overrides
It is possible to overide the location of the log files by using the following environment variables:
LOG_NAME- The name of the log file, e.g.
.logwill be appended to this. If unset logput will try to use
RACK_ENVas a fallback
LOG_LOCATION_DIR- The directory where the log file is located, e.g.
/will be added when combined with the log name.
The overrides will only be used if both are present (or the fallbacks in the case of the log name).
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request