ruby / ruby/logger

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

Open
#165 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
161
Forks
71
Avg merge
3d 22h
Merged PRs (30d)
2

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Logger.new("web-output.log", "daily") and the daily rotation path in logger 1.6.6, reproducing on JRuby 9.4.12.0 on Windows. Compare the File.identical? behavior and rotation flow with logger 1.6.2; done means a due rotation creates the expected dated archive instead of silently continuing in the same file.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.