The rails-tail-log-monitor gem simplifies the process of monitoring server logs by displaying the tail of the log file directly in the terminal window alongside the standard Rails server output. With rails-tail-log-monitor, developers can effortlessly keep track of the most recent log entries without the need for manual log file inspection.
Add this line to your application's Gemfile:
gem 'rails-tail-log-monitor', '~> 1.0.0'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install rails-tail-log-monitor
Make sure your package.json
has actioncable
{
...,
"@rails/actioncable": "^6.0.0"
}
Update config/cable.yml
development:
adapter: redis
url: <%= "redis://localhost:6379/#{ENV.fetch('REDIS_PORT')}" %>
channel_prefix: your_app_development
Update routes.rb
# config/routes.rb
Rails.application.routes.draw do
...
# example for usage same Sidekiq
authenticate :administrator do
mount Sidekiq::Web => '/sidekiq'
mount LogMonitor::Engine => '/log'
end
end
Custom setting config/initializers/rails_tail_log_monitor.rb
LogMonitor.configure do |config|
config.action_cable_url = "ws://localhost:3000/cable"
config.keep_alive_time = 60 # default = 30
end
After installation and configuration, start your Rails application, open http://localhost:3000/log
URL, and make a few requests.
I welcome contributions to this project.
- Fork it.
- Create your feature branch (
git checkout -b your-feature
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin your-feature
). - Create a new pull request.
The gem is available as open source under the terms of the MIT License.