From: Michal Fojtik <mfoj...@redhat.com> This patch will make sure that logs produced by Sequel (SQL logs) will go to DeltacloudLogger instead of default Ruby Logger.
The reason is that user can set the '-L/--log' option and redirect all logs into a file. In that case, this patch will make sure that SQL logs are saved into that file as well. Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- server/lib/db.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/lib/db.rb b/server/lib/db.rb index 9bf7ead..5615f50 100644 --- a/server/lib/db.rb +++ b/server/lib/db.rb @@ -17,7 +17,13 @@ module Deltacloud def self.database(opts={}) - opts[:logger] = ::Logger.new($stdout) if ENV['API_VERBOSE'] + if ENV['API_VERBOSE'] + if Deltacloud.respond_to? :config + opts[:logger] = Deltacloud.config[:cimi].logger + else + opts[:logger] = ::Logger.new($stdout) + end + end @db ||= Sequel.connect(DATABASE_LOCATION, opts) end -- 1.8.1.2