The Pug Automatic

rake solr:tail for acts_as_solr query log

Written December 28, 2007. Tagged Ruby, Ruby on Rails, Rake, acts_as_solr.

Here is a quick (and a bit dirty) Rake task to track the acts_as_solr built-in Jetty server log:

namespace :solr do

desc 'Tails the Solr log'
task :tail => :environment do
system("tail", "-f", "#{RAILS_ROOT}/vendor/plugins/acts_as_solr/solr/tmp/jetty_#{RAILS_ENV}")
end

end

If you put that in e.g. lib/tasks/solr_additions.rake, you can then do rake solr:tail to see the last couple of queries to the Solr server. The output will update as new queries come in (courtesy of tail -f); break out of it with ⌃C.