Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails logs do not show anything in terminal for Puma when I try to hit the URL: localhost:3000

When I do rails s, it successfully starts my server, and serves the page through the URL http://localhost:3000, but the problem is: it doesn't show any changes when I access anything from this server.

enter image description here

I have accessed so many pages, but still it's not showing any hint. I have restarted the Rails server, have killed all the rails servers using:

ps aux | grep 'rails' | grep -v 'grep' | awk '{ print $2 }' | xargs kill -9

Have quit and started again iTerm but nothing is helping me.

I'm using Rails 5.0.0, and ruby 2.2.3.

like image 249
Arslan Ali Avatar asked Sep 06 '25 03:09

Arslan Ali


2 Answers

Add this in development.rb file. I have my app on Rails 6.

config.logger = Logger.new(STDOUT)
like image 130
Milind Avatar answered Sep 07 '25 21:09

Milind


There was a problem in config/puma.rb file, and it took me a night to figure this thing out. Anyway, the correct configuration for Puma while running your server for development is:

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end
like image 34
Arslan Ali Avatar answered Sep 07 '25 23:09

Arslan Ali