自动记录 DataMapper 查询

发布于 2024-08-09 08:53:57 字数 454 浏览 1 评论 0原文

我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罗罗贝儿 2024-08-16 08:53:57

看来我错过了一个完全合理的步骤。在建立连接之前,您需要放置 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文