Search code examples
ruby-on-rails-4consoleforemanputs

Can't output log in console with foreman


I got a rails 4.2.1 app running with foreman 0.78.0

Whenever I try to use "puts" to log a value in my console, nothing append. I try googling this for a bit but I found no working solution.

I tried to add $stdout.sync = true in my development.rb but no result so far (and yes I restarted foreman)

since my app run with angularjs, it tend to be hard to debug when something append only on the server side without any log.

Is there a ways to output the log in the console and fix this? I know it must be a config problem since some of my coworker can do it in the same project. I just don't see the difference between them and mine.

here is the only output I'm able to see when I start foreman.

09:53:15 web.1    | started with pid 68370
09:53:15 worker.1 | started with pid 68371
09:53:17 web.1    | [68370] Puma starting in cluster mode...
09:53:17 web.1    | [68370] * Version 2.11.2 (ruby 2.2.2-p95), codename: Intrepid Squirrel
09:53:17 web.1    | [68370] * Min threads: 1, max threads: 4
09:53:17 web.1    | [68370] * Environment: development
09:53:17 web.1    | [68370] * Process workers: 2
09:53:17 web.1    | [68370] * Phased restart available
09:53:17 web.1    | [68370] * Listening on tcp://0.0.0.0:5060
09:53:17 web.1    | [68370] Use Ctrl-C to stop
09:53:29 web.1    | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::XLSX
09:53:29 web.1    | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of XLSX was here
09:53:29 web.1    | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::XLSX
09:53:29 web.1    | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of XLSX was here
09:53:29 worker.1 | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::XLSX
09:53:29 worker.1 | /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of XLSX was here
09:53:29 web.1    | [68370] - Worker 0 (pid: 68372) booted, phase: 0
09:53:29 web.1    | [68370] - Worker 1 (pid: 68373) booted, phase: 0
09:53:32 worker.1 | 2015-07-14T13:53:32.801Z 68371 TID-ow3bp4a9w INFO: Running in ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
09:53:32 worker.1 | 2015-07-14T13:53:32.801Z 68371 TID-ow3bp4a9w INFO: See LICENSE and the LGPL-3.0 for licensing details.
09:53:32 worker.1 | 2015-07-14T13:53:32.801Z 68371 TID-ow3bp4a9w INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org/pro
09:53:32 worker.1 | 2015-07-14T13:53:32.801Z 68371 TID-ow3bp4a9w INFO: Booting Sidekiq 3.3.4 with redis options {:url=>nil}
09:53:32 worker.1 | 2015-07-14T13:53:32.801Z 68371 TID-ow3bp4a9w INFO: Starting processing, hit Ctrl-C to stop

Thank in advance for your time.


Solution

  • The problem wasn't with foreman... after 3 hour of debuging, I found out that it was power that was misleading the information... Not sure why but by using a symlink nothing was showing up in the console. When I tried using my IP address instead it worked... Not really sure why but as long has it fix the problem everything is fine.