简体   繁体   中英

running rails app in production mode is not displaying the production server logs in terminal. and showing the error something went wrong in browser

When i run the rails app in development mode,server logs are displaying in terminal properly. But when i run the app in production mode server is not displaying any server logs in terminal. and an error is displaying in the browser like "We're sorry, but something went wrong.".i am running the server with the following command.and i am using the thin server.

rails s -e production

this is the output i am getting in server mode when i start the server.and after this when i made any request no output is displaying.

prashant@prashant-pc:~/client_proj/template$ rails s -e production
=> Booting Thin
=> Rails 4.1.5 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

what might be issue i am not getting.

production.rb你可以添加这个选项: config.logger = Logger.new(STDOUT)

If you see this block in the production.rb

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

then you can simply set environment variable to any value with export before starting the rails server

$ export RAILS_LOG_TO_STDOUT=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM