Falko
Falko

Reputation: 1035

How to view the top of long stack trace in rails server error

After running bundle exec rails s I get a huge error when trying to access the app via http://localhost:3000/

To debug this I need to see the top of the error trace, however the error trace is nearly 5000 items long and gets cut off at around line 3500.

How can I view the full error so I can start to debug ?

 4701 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/server.rb
 4702 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/runner.rb
 4703 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/cluster.rb
 4704 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/single.rb
 4705 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/launcher.rb
 4706 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/plugin/tmp_restart.rb
 4707 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/faraday-0.12.1/lib/faraday/adapter/net_http_persistent.rb
 4708 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/backtrace_cleaner.rb
 4709 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/backtrace_cleaner.rb
 4710 /Users/paul/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/web-console-3.5.1/lib/web_console/whiny_request.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.

Upvotes: 0

Views: 694

Answers (1)

Austin Adams
Austin Adams

Reputation: 231

You can redirect the output of the script to a file and look through that for your errors.

bundle exec rails s > my_file

This will put the output in the file "my_file". If you want to include the errors (stderr output) you also need to redirect that, so something like this:

bundle exec rails s > my_file 2>&1

Upvotes: 2

Related Questions