On Mon, 28 Sep 2026 15:02:33 GMT, Yunbo Zhang <[email protected]> wrote:

>> Please review this small fix.
>> 
>> Configuring the same log file as `vm.log`, `$PWD/vm.log`, and `./vm.log` 
>> creates separate outputs, splitting the messages across multiple files.
>> 
>> **Fix:**
>> 
>> Let each output match its own name through `matches_name()`. For file 
>> outputs, also check `os::same_files()` so different paths to the same file 
>> reuse the existing output.
>> 
>> **Testing:**
>> 
>> - Added `TestEquivalentLogFilePaths.java`.
>> - `gtest:LogConfiguration/server`: 21 passed, 0 failed.
>> - `test/hotspot/jtreg/serviceability/logging`: 7 passed, 0 failed.
>> - `test/hotspot/jtreg/runtime/logging`: 33 passed, 0 failed.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Yunbo Zhang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8392135: Unified logging creates extra log files
>   
>   Use virtual output name matching instead of identifying output types by 
> name prefixes and downcasting. Add coverage for file and standard output 
> matching.

I'm approving this, as I consider it better than what we have right now.

Knowing whether this is truly "correct" is kinda hard. Consider a file with 
name `a.log` and a hard link to that file, which we call `b.log`.

Then, with this code, rotation will correctly cause both `LogFileOutput`'s to 
print to the new `a.log`, but the `b.log` hard link will now point to 
`a.log.0`. Is that correct? Eeeh, I don't know! Probably?

-------------

Marked as reviewed by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33090#pullrequestreview-5488015752
PR Comment: https://git.openjdk.org/jdk/pull/33090#issuecomment-6120293000

Reply via email to