【问题标题】:error creating daily logs in rails app on heroku在heroku上的rails应用程序中创建每日日志时出错
【发布时间】:2017-05-04 20:54:58
【问题描述】:

我有一个 Rails 5 应用程序,我想将它推送到 heroku,其中我有一个记录器,它创建一个每日日志文件,我用它来打印出各种状态信息。这在开发中有效,但是当我尝试将其推送到 heroku 时出现错误(在将所有内容推送到 git 之后)。

我收到的错误:“Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_e3fe50d2e37e0a51f1bc7d94dd1fc2f3/log/daily_logs_production/2016-12-19.log "

这是 production.rb 中的相关部分:

if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new("#{Rails.root}/log/daily_logs_production/#{Time.now.strftime('%Y-%m-%d')}.log", 'daily')
    logger.formatter = config.log_formatter
    config.logger = ActiveSupport::TaggedLogging.new(logger)
  end

知道有什么问题吗?谢谢!

【问题讨论】:

    标签: ruby-on-rails git logging heroku rake-task


    【解决方案1】:

    你是否得到错误可以忽略。

    由于 heroku dynos 的 ephemeral filesystem,您不应将其用于此类目的。

    改为安装plugin of the Logging category

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-26
      • 2013-05-03
      • 1970-01-01
      相关资源
      最近更新 更多