Daily log rotation silently skipped on JRuby/Windows with logger 1.6.6 (File.identical?(lock, @dev) is false after fixup_mode)

未关闭
#165 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
ruby

调研方向

从 Logger.new("web-output.log", "daily") 和 logger 1.6.6 中的每日轮转路径开始,在 Windows 上的 JRuby 9.4.12.0 中复现问题。将 File.identical? 的行为和轮转流程与 logger 1.6.2 进行比较;完成的标准是,到期轮转会创建预期的带日期归档文件,而不是继续静默地写入同一个文件。

由索引模型根据 Issue 内容生成。

描述

Environment

  • OS: Windows Server (service via Apache Commons Daemon / prunsrv)
  • JRuby: 9.4.12.0 (OpenJDK 21)
  • logger: 1.6.6 (broken) / 1.6.2 (works)
  • Rails: 7.2, Puma single process (no workers)

Summary

After upgrading to logger 1.6.6, daily log rotation is silently skipped on JRuby/Windows.
Pinning logger to 1.6.2 restores rotation.
This is different from jruby/jruby#8801 (UnsatisfiedLinkError on flock).
We do not crash; rotation simply never happens.

Suspected cause

I observed that File.identical?(lock, dev) returns false
On our host, after fixup_mode, @dev fails the second identical? check:
(File.identical?(path, lock) rescue false)=true
(File.identical?(lock, dev) rescue false)=false
So lock_shift_log never yields -> shift_log_period never runs.

Reproduction(conceptual)

require "logger"
# With logger 1.6.6 on JRuby/Windows:
log = Logger.new("web-output.log", "daily")
# Force rotation due, then write:
# -> no archive created; same file continues

# With logger 1.6.2:
# -> archive created (e.g. web-output.log.YYYYMMDD)
主要语言
Ruby
星标
161
派生
76
平均合并
2 天 5 小时
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/logger 的其他 Issue

查看 ruby/logger 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。