From 415dc31c97916ea15fd5c44c96c6e44c7d0bb1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9stor=20Coppi?= Date: Thu, 18 Dec 2014 11:07:17 -0300 Subject: [PATCH] Set app logger For issue #183 I have the same problem with Rails 4.1.6 and Ruby 2.1 with that, we have covered some cases ^^ --- lib/google/api_client/railtie.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/google/api_client/railtie.rb b/lib/google/api_client/railtie.rb index d02e63456..51edb33b5 100644 --- a/lib/google/api_client/railtie.rb +++ b/lib/google/api_client/railtie.rb @@ -10,7 +10,13 @@ module Google # class Railtie < Rails::Railtie initializer 'google-api-client' do |app| - Google::APIClient.logger = app.logger + _logger = case + when app.respond_to?(:logger) then app.logger + when app.config.respond_to?(:logger) then app.config.logger + else Rails.logger + end + + Google::APIClient.logger = _logger end end end