I have set up Resque in my rails application and it's all working fine. The question I have is where should the logger setup go. Should it be in the initializer or in the rake task? It works when set up in both. The reason I ask is I have seen it used in both in examples across the net.
I am thinking that it should probably be in the initializer as it's best practice to put setup into initializers.
config/initializers/resque.rb
logfile = File.open(File.join(Rails.root, 'log', 'resque.log'), 'a')
logfile.sync = true
Resque.logger = ActiveSupport::Logger.new(logfile)
Resque.logger.level = Logger::INFO
I am then writing out using the Resque.logger syntax in the rake task and jobs.
E.G:
Resque.logger.info "Resque task started!"
Many thanks in advance.
EDIT
I'll stick with the initializer then.
I would definitely put it inside initializer, since it needs to be called only once, while setting up your server.