title: View Resque log output in Rails server logs
body: <p>I've got a Rails 4 app on a Puma server with Resque/Resque-Scheduler running background jobs. What I'd like to know is how I merge the log output of my two Resque workers into my server log, or, of that is not possible, how I can view the log output of my Resque workers. Currently I have not been able to figure out how to view the log output for the workers, so I have no idea what's happening under the hood. I found <a href="http://jademind.com/blog/posts/enable-immediate-log-messages-of-resque-workers/" rel="nofollow">this blogpost</a>, which suggests adding the following likes to my <code>resque.rake</code> file:</p>
  
  <pre><code>task "resque:setup" =&gt; :environment do
    Resque.before_fork = Proc.new { 
      ActiveRecord::Base.establish_connection
  
      # Open the new separate log file
      logfile = File.open(File.join(Rails.root, 'log', 'resque.log'), 'a')
  
      # Activate file synchronization
      logfile.sync = true
  
      # Create a new buffered logger
      Resque.logger = ActiveSupport::BufferedLogger.new(logfile)
      Resque.logger.level = Logger::INFO
      Resque.logger.info "Resque Logger Initialized!"
    }
  end
  </code></pre>
  
  <p>That didn't work. I also tried the suggestion in the comments, which was to replace <code>Resque.logger = ActiveSupport::BufferedLogger.new(logfile)</code> with <code>Resque.logger = ActiveSupport::Logger.new(logfile)</code>, however that didn't work either. With the second option, I still get a <code>NoMethodError: undefined method 'logger=' for Resque:Module</code> error when I try to boot up a worker.</p>
  
  <p>Here is my current <code>resque.rake</code> file:</p>
  
  <pre><code>require 'resque/tasks'
  require 'resque_scheduler/tasks'
  
  namespace :resque do
      puts "Loading Rails environment for Resque"
      task :setup =&gt; :environment do
          require 'resque'
          require 'resque_scheduler'
          require 'resque/scheduler'
          require 'postman'
      end
  end
  </code></pre>
  
  <p>I've looked at the <a href="https://github.com/resque/resque/wiki/Logging" rel="nofollow">Resque docs on logging</a>, but am not sure how to use what's there as I admittedly don't know very much about logging in Rails. I haven't had any luck finding other useful resources on the subject.</p>