views:

685

answers:

2

I am working on a simple app in Sinatra with DataMapper. I want to see the queries that DM is created for my various chained finders, etc.

I have tried:

DataMapper::Logger.new(STDOUT, :debug)

in my configure do ... end block in an environment.rb file that loads when the app is started.

I have also tried:

DataMapper::Logger.new('log/my-app.log', :debug)

Neither yields log statements from the app accessed either through a browser or through an irb session that requires my app. I do see the app starting message.

I am using rackup config.ru to run the app locally.

What am I missing?

A: 

I think you need to enable the logging for Sinatra :

set :logging, true
Mike
+2  A: 

It seems that I missed a perfectly reasonable step. You need to place the DataMapper::Logger.new(STDOUT, :debug) before you make the connection. HT to @snusnu on #datamapper IRC.

kEND