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. src/hotspot/share/logging/logFileOutput.cpp line 62: > 60: return false; > 61: } > 62: char* file_name = make_file_name(name + strlen(Prefix), _pid_str, > _vm_start_time_str); Q2: Does this call to `make_file_name()` work correctly/reliably on Windows? The implementation of the`make_file_name()` might open the same files with different flags like below: static HANDLE create_read_only_file_handle(const char* file) { . . . HANDLE handle = ::CreateFileW(wide_path, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); . . . } bool os::same_files(const char* file1, const char* file2) { . . . HANDLE handle1 = create_read_only_file_handle(native_file1); HANDLE handle2 = create_read_only_file_handle(native_file2); . . . It can be a pre-existed problem though. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33090#discussion_r4319623065
