RFR: 8146879: Add option for handling existing log files in UL

Dmitry Samersoff dmitry.samersoff at oracle.com
Tue Mar 1 13:32:21 UTC 2016


Marcus,

logFileOutput.cpp:

77: Please move this function to include file

149: you have to check that file is a regular one, before any attempt to
rotate.

Please, move this function to include file.

164: As soon as size_t can't represent more than 10 decimal digits,
please replace ceil(log10(static_cast<double>(SIZE_MAX))) to 10


168: It might be better to replace SIZE_MAX to some reasonable value
(e.g. 100) and give a message on overflow. Otherwise VM never starts  in
bad no-log-removal case.

169: please make sure that you produce logname.001, logname.002 etc,
not logname.1 ... logname.10

Many filesystems sorts files alphabetically and tons of user scripts
rely on it.

186: Please print a reason of fail (os error)

-Dmitry

On 2016-03-01 14:11, Marcus Larsson wrote:
> Hi again,
> 
> Taking a different approach to this.
> 
> New webrev:
> http://cr.openjdk.java.net/~mlarsson/8146879/webrev.01/
> 
> Existing files will now by default be renamed/archived with a .X suffix
> where X is the lowest number such that the resulting file name is
> available (jvm.log becomes jvm.log.0). A mode option for controlling
> this behavior has been added as well. It can be set to archive, append,
> or truncate (i.e. -Xlog::jvm.log::mode=truncate).
> 
> Tested with included jtreg test through JPRT.
> 
> Thanks,
> Marcus
> 
> On 01/14/2016 04:00 PM, Marcus Larsson wrote:
>> Hi,
>>
>> Please review the following patch to make sure UL truncates existing
>> log files before writing to them. Since files are opened in append
>> mode, truncation isn't done automatically, so instead the patch adds
>> an attempt to remove the log file before opening it.
>>
>> Webrev:
>> http://cr.openjdk.java.net/~mlarsson/8146879/webrev.00/
>>
>> Issue:
>> https://bugs.openjdk.java.net/browse/JDK-8146879
>>
>> Testing:
>> Included test through JPRT
>>
>> Thanks,
>> Marcus
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.


More information about the hotspot-runtime-dev mailing list