【问题标题】:Rails Production log dont updateRails 生产日志不更新
【发布时间】:2021-07-19 00:51:21
【问题描述】:

我使用的是 Rails 6.0.3

在生产中,我尝试在生产日志上运行 tail -f,但当我对应用程序执行任何操作时,我没有收到更新。有什么想法吗?

我尝试对 production.log 文件应用 0644 权限,但这不是问题,因为文件中有数据。

我也在使用 nginx 和 puma。

生产日志:

生产日志文件权限

-rw-rw-r--  1 ubuntu ubuntu  733 Apr 25 11:44 production.log

production.rb

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false

  # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
  # config.require_master_key = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Store uploaded files on the local file system (see config/storage.yml for options).
  config.active_storage.service = :local

  config.cache_store = :redis_cache_store, { url: "redis://localhost:6379/0" }

  # Mount Action Cable outside main process or domain.

  .....

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :debug

  # Prepend all log lines with the following tags.
  # config.log_tags = [ :request_id ]

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store


  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  ............

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false

end

提前致谢。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-6


    【解决方案1】:

    我通过将这些行添加到我的生产文件中解决了我的问题: config.logger = Logger.new (Rails.root.join("log/production.log"))

    并在生产服务器上重新启动 cougar。

    【讨论】:

      猜你喜欢
      • 2017-02-19
      • 1970-01-01
      • 2011-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-05
      • 1970-01-01
      相关资源
      最近更新 更多