5 Logging

This chapter describes various logging options available in Oracle JRockit and HotSpot.

Note:

Some of the tools described in this document require a commercial license for use in production. To learn more about commercial features and how to enable them, see http://www.oracle.com/technetwork/java/javaseproducts/.

Verbose Logging

Verbose logging in HotSpot can be turned on 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 Note

alloc

--

--

class

-verbose:class

Displays information.

codegen

--

--

compaction

--

--

cpuinfo

--

--

exceptions

--

--

gc

-verbose:gc

Displays information about each garbage collection (GC) event.

gcheuristic

--

--

gcpause

--

--

gcpausetree

--

--

gcreport

--

--

load

--

--

memory

--

--

memdbg

--

--

opt

--

--

refobj

--

--

starttime

--

--

shutdown

--

--

systemgc

--

--

timing

--

--

--

-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 turn on the diagnostic output for a specific subsystem within the HotSpot JVM.

Table 5-2 Logging Options

HotSpot Logging Options Note

-Xloggc:<filename>

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

-XX:LogFile=<path>

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

-XX:+PrintCommandLineFlags

Enables printing of ergonomically 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 see the generated code, which may help you to diagnose 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 see which methods 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 which regions are allocated and which 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 how much time elapsed since the last pause (for example, a GC pause).

-XX:+PrintGCApplicationStoppedTime

Enables printing of how much time the pause (for example, a GC pause) 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.