自动记录 DataMapper 查询
我正在 Sinatra 中使用 DataMapper 开发一个简单的应用程序。我想查看 DM 为我的各种链接查找器创建的查询等。
我已经尝试过:
DataMapper::Logger.new(STDOUT, :debug)
在 environment.rb
中的 configure do ... end
块中应用程序启动时加载的文件。
我也尝试过:
DataMapper::Logger.new('log/my-app.log', :debug)
通过浏览器或通过需要我的应用程序的 irb 会话访问的应用程序都不会产生日志语句。我确实看到了应用程序启动消息。
我正在使用rackup config.ru 在本地运行应用程序。
我缺少什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我错过了一个完全合理的步骤。在建立连接之前,您需要放置
DataMapper::Logger.new(STDOUT, :debug)
。 HT 发送至 #datamapper IRC 上的 @snusnu。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.