Documentation Contents
Java Platform, Standard Edition Deployment Guide
Contents Previous Next

# 20 Java Console, Tracing, and Logging

This topic describes the Java Console, a debugging aid that redirects any System.out and System.err to the console window. The console is available for applets running with Java Plug-in and applications running with Java Web Start.

This topic includes the following sections:

- Section 20.1, "Debugging Options in the Java Console"

- Section 20.2, "Tracing and Logging"

## 20.1 Debugging Options in the Java Console

Figure 20-1 shows the options that are available in the Java Console for debugging applets and Java Web Start applications.

Figure 20-1 Java Console

Description of "Figure 20-1 Java Console"

An option is selected by typing its letter or number when the Java Console window has focus. The options are described in Table 20-1.

Table 20-1 Java Console Debugging Options

Key | Description
--- | ---
c: | Clears the Java Console window.
f: | Triggers finalization on the objects in the finalization queue and then displays memory information. Memory refers to the current heap size used by the JRE. Free is the available memory that is free in the heap. The percent (xx%) is the free memory as a percent of the total heap size.
g: | Triggers garbage collection and displays memory information as described above.
h: | Displays help message, which is being described here.
l: | Displays a list of the cached `ClassLoader` objects in the Java Plug-in. Classes are cached to avoid having to load them again when returning to previously-visited pages. When a page is visited the first time, a `ClassLoader` object will be created and all of the classes that are downloaded will be cached in that object. These objects are created and cached according to their `codebase`. To identify a `ClassLoader` object, the "classloader list" displays the `codebase` for that object. Additional information displayed with a `ClassLoader` object includes `zombie`, `cache` and `info`. `zombie = true` indicates that a `ClassLoader` object is not being used (i.e., the applet is not currently loaded on the page). `cache = true` indicates that the applet should be cached, while `false` indicates that the applet will be destroyed when the page is left. `info` is a value used for debugging.
m: | Displays heap memory usage as described above.
o: | Triggers logging, which directs output from the Java Plug-in Console to a log file.
p: | Reloads the proxy configuration.
q: | Causes the Java Console to disapper from the main screen.
r: | Reloads the policy configuration.
s: | Prints out the system properties. This is mostly for debugging.
t: | Prints out all the existing thread groups. The first group shown is `Group main`. `ac` stands for active count; it is the total number of active threads in a thread group and its child thread groups. `agc` stands for active group count; it is the number of active child thread groups of a thread group. `pri` stands for priority; it is the priority of a thread group. Following `Group main`, other thread groups will be shown as `Group <`name`>`, where name is the URL associated with an applet. Individual listings of threads will show the thread name, the thread priority, `alive` if the thread is alive or `destroyed` if the thread is in the process of being destroyed, and `daemon` if the thread is a daemon thread.
x: | This removes (destroys) all `ClassLoader` objects in the cache. Modified jar files will be downloaded from the server when a page with an applet is refreshed or revisited if you first do this: type "x" in the Java Console to clear the Classloader cache.
0-5: | This sets the trace-level options as described in Section 20.2, "Tracing and Logging"Section 20.2, "Tracing and Logging.".

## 20.2 Tracing and Logging

Tracing is a facility to redirect any output in the Java Console to a trace file. Similar to tracing, logging is a facility to redirect any output in the Java Console to a log file using the Java Logging API.

### 20.2.1 Tracing

Tracing for Java Plug-in and Java Web Start can be turned on by setting the property `deployment.trace` property to `true`. This property turns on all tracing facilities inside Java Plug-in and Java Web Start. To enable more fine-grained tracing, the `deployment.trace.level` property can be used. The `deployment.trace.level` property can have one of the following values:

- basic

- cache

- net

- security

- ext

- liveconnect

- drs

To use all of the tracing levels, set `deployment.trace.level` to `all`.

To enable tracing while running, you can set trace-level options (0-5) in the Java Console, with the following meanings:

- 0: off

- 1: basic

- 2: network, cache, and basic

- 3: security, network and basic

- 4: extension, security, network and basic

- 5: LiveConnect, extension, security, network, temp, basic, and Deployment Rule Set

See Section 20.1, "Debugging Options in the Java Console" for information.

Another way to set fine-grained tracing is through the Java Control Panel. For example, to enable tracing for everything (option 5 above), enter the following options in the "Java Run Time Parameters" textfield:

    -Ddeployment.trace=true
    -Ddeployment.trace.level=all

See Section 18.3.2, "Java Runtime Parameters" for more information.

Tracing set through the Control Panel takes effect when Java Plug-in or Java Web Start is launched, but changes made through the Control Panel while Java Plug-in or Java Web Start is running has no effect until restarted.

### 20.2.2 Logging

To enable logging perform the following actions:

- Open Java Control Panel

- Click Advanced tab.

- Select Enable Logging under the Debugging option

### 20.2.3 File Names

- `plugin<random-number>.trace` - Name of the trace file for Java Plug-in.

- `plugin<random-number>.log` - Name of the log file for Java Plug-in.

- `javaws<random-number>.trace` - Name fo the trace file for Java Web Start.

- `javaws<random-number>.log` - Name of the log file for Java Web Start.

- `jcp.trace` - Name of the trace file that is created when the Java Control Panel is run.

`<random-number>` is a number that is generated when the file is created.

### 20.2.4 File Locations

The default location (directory) of the trace and log files is:

- `<user.home>/.java/deployment/log` on Solaris and Linux

- `~/Library/Application Support/Oracle/Java/Deployment/log` on OS X

- `<User Application Data Folder>\Sun\Java\Deployment\log` on Windows

If the environment variable `USER_JPI_PROFILE` is set to `<user plugin home>` then the trace and log files will be written to:

- `<user plugin home>/.java/deployment/log` on Solaris and Linux

- `<user plugin home>/Library/Application Support/Oracle/Java/Deployment/log` on OS X

- `<user plugin home>\Sun\Java\Deployment\log` on Windows

Contents Previous Next

Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.
Contact Us