5 Logging

This topic describes the various logging options available in Oracle JRockit and HotSpot:

Verbose Logging

Verbose logging in HotSpot can be enabled using the -verbose option. There are some specific flags that can be used with this option to get area-specific verbose output.

The following table lists various logging options available in Oracle JRockit and compares them with the options available in HotSpot:

Table 5-1 Verbose Logging

Oracle JRockit Verbose Module HotSpot Option Notes

alloc

NA

NA

class

-verbose:class

Displays information about the classes that are being loaded.

codegen

NA

NA

compaction

NA

NA

cpuinfo

NA

NA

exceptions

NA

NA

gc

-verbose:gc

Displays information about each garbage collection (GC) event.

gcheuristic

NA

NA

gcpause

NA

NA

gcpausetree

NA

NA

gcreport

NA

NA

load

NA

NA

memory

NA

NA

memdbg

NA

NA

opt

NA

NA

refobj

NA

NA

starttime

NA

NA

shutdown

NA

NA

systemgc

NA

NA

timing

NA

NA

NA

-verbose:jni

Displays information about the use of native methods and other Java Native Interface (JNI) activity.

HotSpot Logging Options

These are some of the common logging options available in HotSpot that can be used to enable the diagnostic output for a specific subsystem within the HotSpot JVM.

Table 5-2 Logging Options

HotSpot Logging Options Notes

-Xloggc:<filename>

Sets the file to which verbose GC event information must be redirected for logging. The information written to this file is similar to the output of -verbose:gc with the time elapsed from the first GC event preceding each logged event. The -Xloggc option overrides the-verbose:gc, if both are given with the same java command.

-XX:LogFile=<path>

Sets the path and file name where the log data is written.

-XX:+PrintCommandLineFlags

Enables printing of the selected JVM flags that appeared on the command-line.

-XX:+PrintNMTStatistics

Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled.

-XX:+LogCompilation

Enables logging of compilation activity to a file named hotspot.log in the current working directory. You can specify a different log file path and name using the -XX:LogFile option. The -XX:+LogCompilation option must be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options.

-XX:+PrintAssembly

Enables printing of assembly code resulting from JIT compilation of Java bytecode by using the external disassembler.so library. This option enables you to view the generated code, which helps you to diagnose the performance issues. This option must be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options.

-XX:+PrintCompilation

Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled.

-XX:+PrintInlining

Enables printing of inlining decisions. This option enables you to view the methods that are getting inlined.

-XX:+PrintClassHistogram

Enables printing of a class instance histogram after a Control+C event (SIGTERM). By default, this option is disabled.

-XX:+PrintConcurrentLocks

Enables printing of java.util.concurrent locks after a Control+C event (SIGTERM). By default, this option is disabled.

-XX:+G1PrintHeapRegions

Enables the printing of information about the regions that are allocated and that are reclaimed by the G1 collector.

-XX:+PrintAdaptiveSizePolicy

Enables printing of information about adaptive generation sizing.

-XX:+PrintGC

Enables printing of messages at every GC.

-XX:+PrintGCApplicationConcurrentTime

Enables printing of the time elapsed from the last pause (for example, a GC pause).

-XX:+PrintGCApplicationStoppedTime

Enables printing of the duration of the pause (for example, a GC pause) that lasted.

-XX:+PrintGCDateStamps

Enables printing of a date stamp at every GC.

-XX:+PrintGCDetails

Enables printing of detailed messages at every GC.

-XX:+PrintGCTaskTimeStamps

Enables printing of time stamps for every individual GC worker thread task.

-XX:+PrintGCTimeStamps

Enables printing of time stamps at every GC.

-XX:+PrintStringDeduplicationStatistics

Prints detailed deduplication statistics.

-XX:+PrintTenuringDistribution

Enables printing of tenuring age information.

-Xlog

Enables the common logging system for all JVM components.