Profile Image
vishnupriya

What is JVM startup parameter: -XX:+LogCompilation?

What is JVM startup parameter: -XX:+LogCompilation? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-logcompilation

  • x-logcompilation

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

This option allows the JVM to log compilation activity in detail to LogFile.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

This will enable the JVM to log detailed compilation activity to the LogFile:

 

-XX:+LogCompilation

 

Description:

 

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 logs are displayed with an XML format (the size of the logs can reach 100 of MB or more) which will contain a detailed level of steps of the JVM compiler.

 

By default, this option is disabled and compilation activity isn’t logged. The -XX:+LogCompilation option has to be used together with the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic JVM options.

 

You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the -XX:+PrintCompilation option.

 

Here is an example of an output of LogCompilation in case of the method String.equals:

 

<nmethod compile_id='3' compiler='C2' entry='0x00000000000001' size='468' address='0x00000000000001' relocation_offset='263' consts_offset='468' insts_offset='281' method='java/lang/String equals ()I' bytes='32' count='215' iicount='215' stamp='0.230'/>

 


As we can see, the format is a little difficult and not easy to read. But you can use tools such as
LogCompilation to parse your compilation log.

 

Default Value:

 

By default, this option is disabled.

 

Arguments related:

 

LogFile, UnlockDiagnosticVMOptions

 

Related Posts:

 

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-logcompilation

  • x-logcompilation

  • JVM startup parameter