Ruby on rails 未在Rails生产服务器中提取自定义日志文件
我有一个带有自定义日志文件的自定义记录器,该日志文件在我的代码中的某些部分被调用Ruby on rails 未在Rails生产服务器中提取自定义日志文件,ruby-on-rails,ruby,Ruby On Rails,Ruby,我有一个带有自定义日志文件的自定义记录器,该日志文件在我的代码中的某些部分被调用 class MyCustomLogger def initialize(message={}) @message = message end def send_to_log_file logger = ActiveSupport::BufferedLogger.new(Rails.root.join('log/recommended_profiles.log')) logge
class MyCustomLogger
def initialize(message={})
@message = message
end
def send_to_log_file
logger = ActiveSupport::BufferedLogger.new(Rails.root.join('log/recommended_profiles.log'))
logger.info "Job ID: #{@message[:job_id]} | Profile ID: #{@message[:profile]} | User ID: #{@message[:user_id]}"
end
end
我的生产服务器中有我的日志/推荐的\u profiles.log
文件。但我得到了一个错误:
Errno::ENOENT: No such file or directory -
/data/prod/releases/20150701071135/log/recommended_profiles.log
如何重写以仅使用该文件?忽略时间戳
更新:
我使用的是unicorn,我有一个当前路径,我想称之为
current\u path='/data/prod/current'
。但是它会读取releases文件夹。是否。/log/recommended_profiles.log
有效?已经有Rails.root
了?请尝试Rails.root.join(“../log/recommended_profiles.log”)
。您的生产环境中是否存在日志
文件夹?我使用的是unicorn,我有一个当前路径,我想称之为当前路径='/data/prod/current'
。但它会读取释放
文件夹。