1

I am using Bluemix Ruby buildpack out of the box. I add some puts lines in my main *.rb file but nothing appears when tailing logs:

cf logs myapp

Searching the docs, I found this post at developerWorks where it is recommended to set runtime into development mode.

I have tried with:

cf set-env myapp RAILS_ENV development

and also adding to the code:

ENV['RAILS_ENV'] = 'development'

but nothing appears in the logs.

Also tried Sinatra options (after changing the code) with same results:

set :environment, :development
set :logging, true

An interesting thing, is that if I stop the app, then all my puts appears after the stacktrace of the FATAL SignalException: SIGTERM error. It seems like a buffer flush contention or anything like that?

Any advice? Thanks!

Jose Miguel Ordax
  • 1,151
  • 1
  • 9
  • 20

2 Answers2

3

You can add the following line to your config.ru file. This will disable buffering to stdout and allows your puts commands to stdout to appear correctly in the log output.

$stdout.sync = true

See the answer at What STDOUT.sync = true means? for more details about how puts buffers.

Community
  • 1
  • 1
jimmc
  • 585
  • 2
  • 9
-1

Not Sure but have you tried the following links

https://developer.ibm.com/answers/questions/21548/debugging-a-ruby-app-in-bluemix-with-puts-or-print-statements-written-to-the-log-is-it-possible.html

http://www.ibm.com/developerworks/aix/library/au-unix-commandline/

Amol
  • 133
  • 2
  • 11