geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

"Geokit is using the domain: localhost" is logged on every request in to the application log #101

Closed mitya closed 8 years ago

mitya commented 8 years ago

Geokit dumps some message to the application log on every single request, I definitely don't found it useful, especially given that I use Geokit only to calculate the distances.

timrogers commented 8 years ago

:+1:

AndreiMotinga commented 8 years ago

👍

boazadato commented 8 years ago

👍

in the meantime i used (in an initialzer):

#monkey patch to remove that 'Geokit is using the domain' annoying log.
# to be removed when https://github.com/geokit/geokit-rails/issues/101 is resolved.
# based on $GEM_HOME/gems/geokit-rails-2.2.0/lib/geokit-rails/geocoder_control.rb
module Geokit
  module GeocoderControl
    def set_geokit_domain
      Geokit::Geocoders::domain = request.domain
    end
  end
end
mnoack commented 8 years ago

@mitya @timrogers @AndreiMotinga @boazadato This error message is caused in https://github.com/geokit/geokit-rails/blob/master/lib/geokit-rails/geocoder_control.rb#L17

However it's ONLY occurring in 'debug' which is meant to be quite annoying and provide detail.

Now according to the docs rails does have debug as the default for all environments but it's not recommended. You would generally want debug/info in development, and warn/error in production.

I'm open to changing the log-level of this an other messages, but I would like to hear why this message shouldn't show in a 'debug' setting.

boazadato commented 8 years ago

@mnoack while i agree in general, this log line has little value, and to tune the whole environment log lever just for this is rather an overkill. One may want to run in debug and still opt out of certain library logging. In a lot of gems there's an option to tune that gem specific log level, e.g. mongoid: config.mongoid.logger = Logger.new($stdout, :warn)

mnoack commented 8 years ago

@boazadato I've pushed the removal of that line. I won't release a gem just yet, but you can point to master temporarily. I'll have a look at some other issues and see if there's anything else to merge before doing so.

boazadato commented 8 years ago

@mnoack thank a lot. for this and for the whole gem 👍

pedantic-git commented 7 years ago

Thanks for this fix! I was wondering if you had another release of this gem planned - this issue was closed almost 10 months ago. :grin:

mnoack commented 7 years ago

@mitya @timrogers @AndreiMotinga @boazadato @pedantic-git geokit-rails 2.3.0 with this fix has been released.

Yes, usually I like to merge, let people people to master for a bit (beta-testers for that and other fixes), then release, but 10 months it's definitely overdue!

pedantic-git commented 7 years ago

Thanks so much!!