1
votes

I am running rake tasks on the server using a snippet like the following in the deploy.rb of a rails app.

  desc 'Invoke rake task on the server'
  task :invoke do
    fail 'no task provided' unless ENV['task']

    on roles(:app) do
      within release_path do
        with rails_env: fetch(:rails_env) do
          execute :rake, ENV['task']
        end
      end
    end
  end

The rake task runs ok but I would like to see the output from the rake task displayed in the console where I run the capistrano task.

puts commands in the rake task do not appear.

1
I just found that it depends on the server. On my staging server there is no output returned whereas on my production server there is output ...giorgio

1 Answers

0
votes

If in Debug mode, capistrano prints out the outputs of the commands if I'm not mistaken. Probably you set your log level to :info. Just find the line in your deploy.rb and change it to (add it if its not there):

set :log_level, :debug

If you want to have this only for the single command or I was wrong and the above solution does not work for you, maybe checkout this answer (dunno if its still working): Capistrano log level

UPDATE: How about using Rails logger instead of puts in the game task:

Rails.logger.debug "test"