RFR (L): 8046148: JEP 158 Unified JVM Logging

Marcus Larsson marcus.larsson at oracle.com
Fri Sep 11 08:25:59 UTC 2015

Hi David,

On 2015-09-11 08:06, David Holmes wrote:
> Hi Marcus,
> Just a quick scan of this ...
> thread.cpp:
> You moved create_vm_timer to the start of the method:
> 3292 jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
> 3293   extern void JDK_Version_init();
> 3294
> 3295   // Record VM creation timing statistics
> 3296   TraceVmCreationTime create_vm_timer;
> 3297   create_vm_timer.start();
> but the TimeStamp class has direct and indirect dependencies on the 
> os:: subsystem which has not been initialized yet. You get away with 
> it when only calling start() but even that need not be guaranteed on 
> all platforms if some configuration needs to be done regarding 
> javaTimeMillis. Please move it to after os::init().
> Thanks,
> David
> -----

Nice catch, I'll move it. Thank you for looking at this!


> On 7/09/2015 11:33 PM, Marcus Larsson wrote:
>> Hi,
>> Please review the following patch adding the unified logging framework
>> to hotspot.
>> JEP:
>> https://bugs.openjdk.java.net/browse/JDK-8046148
>> Webrev:
>> http://cr.openjdk.java.net/~mlarsson/8046148/webrev.00/
>> See the JEP description for a general overview of the new feature. Below
>> are some notes on the implementation.
>> The patch adds the new 'share/vm/logging' subdirectory containing the
>> unified logging framework. The main entry point is log.hpp, which
>> contains the necessary macros and definitions to use the framework.
>> Log tags are defined/listed in logTag.hpp, and are passed as template
>> arguments to the Log class. Every combination of tags used in a log call
>> has a corresponding LogTagSet instance, which keeps a track of all the
>> outputs it should write the log message to (and their levels). Having
>> tags as template arguments allows mapping directly from a set of tags to
>> the LogTagSet instance, which means that the overhead for disabled
>> logging should be low. Currently each log message can be tagged with up
>> to 5 tags, but this can be increased if ever required (and with C++11's
>> variadic templates the limit can be removed completely).
>> The LogConfiguration class keeps track of configured outputs (stdout,
>> stderr, and possible file outputs). Configuration is done either by
>> command line arguments (-Xlog) or by DCMD. Both methods will in turn use
>> the LogConfiguration class to perform the parsing & configuration. This
>> configuration includes iterating over all LogTagSet instances and
>> updating them accordingly. The LogTagLevelExpression class is used to
>> represent the selection of tags and levels for a given configuration
>> request (the "what"-expression).
>> The LogDecorators class contains a selection of decorators. Instances of
>> this class is kept in LogTagSet to track what decorators to use (this is
>> the union of all decorators used by its outputs). Each log call will
>> create a LogDecorations instance (note: different classes), which will
>> contain the actual decoration strings for the log message. These
>> decorations are used for each output the tagset is set to log on, and
>> are then discarded.
>> The LogPrefix class allows messages of specific sets of tags to be
>> prefixed. The prefix should supply a printf-style format with argument.
>> (This allows GC logging to prefix messages of certain tagsets with
>> GCId.) Prefixes are implemented using template specializations based on
>> the specified tags, with the general/unspecialized case giving an empty
>> prefix.
>> The LogOutput class defines the interface for all types of log outputs.
>> LogFileStreamOutput corresponds to FILE* stream based log outputs.
>> LogFileOutput builds on this and adds the file management and log
>> rotation support.
>> A simple jtreg test is included in this patch. Additional tests will be
>> added at a later stage.
>> Thanks,
>> Marcus

More information about the hotspot-dev mailing list