Heroku: see params and sql activity in logs?

前端 未结 6 2159
不思量自难忘°
不思量自难忘° 2020-12-07 22:52

When i view my heroku logs on the server (with heroku logs --tail --app myapp) i see something like this:

2011-06-21T14:09:25+00:00 app[web.1]:          


        
6条回答
  •  太阳男子
    2020-12-07 23:37

    The detailed log you want is generated by the function start_processing in log_subscriber.rb.

    action_controller/log_subscriber.rb:

    def start_processing(event)
      payload = event.payload
      params  = payload[:params].except(*INTERNAL_PARAMS)
    
      info "  Processing by #{payload[:controller]}##{payload[:action]} as #{payload[:formats].first.to_s.upcase}"
      info "  Parameters: #{params.inspect}" unless params.empty?
    end
    

    I checked with rails 3.0.4 in development and production environment. In both environments, we have the detailed logs.

    This is an info level log. That's why the debug log level is not changing the output.

    I installed the plugin used by heroku rails_log_stdout (Heroku logging) but I still have the desired output.

    Right now, I can't test with heroku to find out why you don't have all the logs.

    In the heroku example (see Heroku logging, section log retrieval), we don't see the "Processing" and "Parameters" lines. I think that either this method is not called when the app is running on heroku (it is somehow disabled) or heroku skips logs starting with whitespaces. Could you try to log messages starting with whitespaces and see if heroku is showing them?

提交回复
热议问题