Rails控制台中的重复记录器输出

时间:2016-07-03 21:27:38

标签: ruby-on-rails ruby-on-rails-4 logging

我在我的一个Rails项目中使用pry-rails,但每次使用Rails记录器时都会复制控制台输出。

示例:

Running via Spring preloader in process 21550
Loading development environment (Rails 4.2.6)
[1] pry(main)> Rails.logger.info "Hello! Is there echo in here?"
Hello! Is there echo in here?
I, [2016-07-03T17:21:02.430621 #21550]  INFO -- : Hello! Is there echo in here?
=> true

所以,我得到一个类似于put的输出和正式的输出。

我正在发送我的Gemfile,但作为摘要:

  • 我正在使用rails_12factor,但它只在生产中使用,我检查过,我在开发环境中。
  • 我几乎尝试了其他地方的所有配置
  • 这是唯一一个出现这种麻烦的项目,但我找不到与其他人的巨大差异。

的Gemfile

source 'https://rubygems.org'
ruby '2.2.3'

gem 'bundler', '>= 1.12'
gem 'rails', '~> 4.2.6'
gem 'sass-rails', '~> 5.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jbuilder', '~> 2.0'
gem 'active_model_serializers'
gem 'kaminari'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'pg'
gem 'pg_search'
gem 'activerecord-postgis-adapter'
gem 'eu_central_bank'
gem 'money-rails'
gem 'rack-cors', :require => 'rack/cors'
gem 'puma'
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
gem "refile-s3"
gem "rest-client"
gem 'redis'
gem 'sidekiq'
gem 'sinatra'
gem 'devise'
gem 'will_paginate'
gem 'postmark-rails'
gem 'memcachier'
gem 'dalli'
gem 'newrelic_rpm'
gem 'aasm'
gem 'pry-rails' #, groups: [:test, :development]
group :production do
  gem 'rails_12factor'
end
group :development do
  gem 'quiet_assets'
  gem 'spring'
  gem 'dotenv-rails'
  gem "better_errors"
  gem "binding_of_caller"
end
group :test, :development do
  gem 'awesome_print'
  gem 'faker'
  gem 'factory_girl_rails'
  gem "capybara"
  gem "selenium-webdriver"
end
gem 'angular-rails-templates'
gem 'jader'

1 个答案:

答案 0 :(得分:1)

基于此question以及您所做的事情:

启动pry并输入:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);

    TextView helptitle = (TextView)findViewById(R.id.title_help);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "beyond_the_mountains.ttf");
    helptitle.setTypeface(typeface);
}

这似乎有效。