0

I have a padrino install that is using datamapper and logging queries to a file. This is working fine when browsing my application. But queries are not logged if executed inside a rake file. Why?

This is how the task is defined:

# lib/tasks/example.rake
task :example => :environment do
  players = Player.all #Player is a datamapper object
  puts players.first.to_s
end

I also added this line to /config/boot.rb

Padrino::Logger::Config[:development] = { :log_level => :devel, :stream => :to_file }

And this line is called in /config/database.rb

DataMapper.logger = logger

And this is how I'm executing the script

$ padrino rake example
marcosdsanchez
  • 2,529
  • 2
  • 17
  • 20

1 Answers1

0

Invoke rake with:

PADRINO_LOG_LEVEL=development padrino rake my:task
DAddYE
  • 1,719
  • 11
  • 16