RFR: 8349083: Factor out filename handling code from logging

Zhengyu Gu zgu at openjdk.org
Mon Feb 3 14:02:47 UTC 2025


On Mon, 3 Feb 2025 11:58:30 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Factor out filename substitution code from unified logging, so that it can be used elsewhere:
>> 
>> 1. Make filename substitution consistent.  Support following substitutions cross JVM
>> ```   
>>    %p -> pid
>>    %t -> timestamp
>>    %hn -> hostname
>> 
>> 
>> 2. Reduce redundant code
>
> src/hotspot/share/utilities/filenameUtil.hpp line 41:
> 
>> 39:   // Expand wildcards in filename:
>> 40:   // %p -> PID
>> 41:   // %t -> timestamp in YY-MM-DD_HH_MM_SS format
> 
> Not just a "timestamp" though it is specifically the VM start time.

The "timestamp" comes from `os::javaTimeMillis()`, it is not the VM start time. 

Unified logging captures the VM start time and uses it from its filename.


   output = new LogFileOutput(name, _vm_start_time);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23410#discussion_r1939423915


More information about the hotspot-dev mailing list