Oracle JDK usagetracker

All

Intro

On Oracle JDK you have this usage tracker that can record information about the JDK usage. It’s quite interesting and useful for debugging and profiling Java applications.

Usage Tracker

It’s a usage tracker – i.e a file with several details about usage. The values are in ” ” and separated by commas (default, you can change this configuring additional options)

 

Usage Tracker Output

An example of the output is below:

"javaws application",
"Mon Feb 01 14:52:58 PST 2016",
"MY-COMPUTER/192.0.2.0",
"https://docs.oracle.com/javase/tutorialJWS/samples/deployment/
  dynamictree_webstartJWSProject/:
  sourceURL=https://docs.oracle.com/javase/tutorialJWS/samples/
    deployment/dynamictree_webstartJWSProject/dynamictree_webstart.jnlp
  app_model=eJytU9FqE0EUvWlSk9pQsSKCIgSpKCIzD4I++BQThZS1LU1FfSrTzbTZMDszztxt
    E4WCP1HwwT/wP3z3G3z1DwS9s7tpF5Q8dR9md/aeueeec+98+wXL3sGd2KTMZ5qN
    pFVmxpw8ZF1rX5uRVFA8tSW4GkErpl8HwkuEtWgijgXXEvmb3eh5BKsj6WOXWEyM
    RlgvwkroIz5El+gjgqzLKUrtCbArvclcLD3CzQKZYaJ41zkxixKPBG5PhDuHfYBT
    qBO/MrEIBGFfi2AlFYnuKeFzwBId8jLOXIKzUDvCo4iUcVLGC2WclPG5so1hBUuE
    y5igkmWiBs4sJbi3MMEeYejglWOpR8blJ6eW/GwHRYysYWTN2f1nT2///unq0BxA
    ayz8uEeHB9CwxiFJEBmOTShjznyYXFQxNh7L75Z1Bk1sVLmvUykl5Z/yQbg2MrFn
    xolYSUalI7zioRgvOWZINEJtvh1yL1KrpC9FpVIjH820SJMYnZT7J/LAo3BI0B1n
    JjJGHphWEJbHiNbbXOWNXGXoGzvv2/Tzj7tfvouvdaiRQp98lFMbxuekEdZp3qZ2
    GKf8R42yPFgwexubFyNwMYdL/85B81g6X25DC8K7OXelLP395RjRL8J7FO7L1DCa
    0pwgLKtkTKGxyc+efKqQ718O+f/CbKKVrZaA8Hge65nUGk2Juy4es0rp5LBKCgtP
    HTxc1IPqLSmbAOvUSwdr+QCEK85e6iytBi1Cc9jd6r/YfodwvSTuBOZOcI04O4s4
    w8WqpgvKbiGsdnd2okGvuzfY3kJon6eVIv0L97SYOQ==",
"C:\Java\jre1.8.0_71",
"1.8.0_71",
"25.71-b15",
"Oracle Corporation",
"Oracle Corporation",
"Windows 7",
"x86",
"6.1",

The example above is output and shows several details about the usage, including the architecture, x86, the JDK, the JRE version/location, the OS, in one file.

To enable Usage Tracker

  1. First option: create usagetracker.properties – as follows:
# UsageTracker template properties file.
# Copy to <JRE directory>/conf/management/usagetracker.properties
# (or <JRE directory>/lib/management/usagetracker.properties for
# JRE releases prior to 9) and edit, uncommenting required settings, to enable.
 
# Settings for logging to a file:
# Use forward slashes (/) because backslash is an escape character in a
# properties file.
# com.oracle.usagetracker.logToFile = ${user.home}/.java_usagetracker

# Settings for logging to a UDP socket:
# com.oracle.usagetracker.logToUDP = hostname.domain:32139
  
# (Optional) Specify a file size limit in bytes:
# com.oracle.usagetracker.logFileMaxSize = 10000000
 
# If the record should include additional Java properties,
# this can be a comma-separated list:
# com.oracle.usagetracker.additionalProperties = 
 
# Additional options:
# com.oracle.usagetracker.verbose = true
com.oracle.usagetracker.separator = ,
com.oracle.usagetracker.quote = "
com.oracle.usagetracker.innerquote = '

 

  1. Second option: apply directly on <file in the central file system location>
java -Dcom.oracle.usagetracker.config.file=/path/usagetracker.properties MyApplication

 

Additional options

The options below, are for the file output itself.

# Additional options:
# com.oracle.usagetracker.verbose = true
com.oracle.usagetracker.separator = ,
com.oracle.usagetracker.quote = "
com.oracle.usagetracker.innerquote = '

OpenJDK

Up to my knowledge, at this moment, the OpenJDK version is not ready yet. Ofc, I might be wrong. The is the Jira bug.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s