Diagnostics and tracing

The diagnostics and tracing functionality provided by Symbian SDKs allows you to monitor the activities of a MIDlet as it is running in an emulator or on a Symbian device. You can monitor the following types of data:

  • Diagnostic data on the MIDlet's HTTP connections (requests and responses)

  • Tracing data returned by the MIDlet, for example, system output messages

  • Tracing data returned by the Java Runtime, for example, MIDlet runtime error messages

The Java Runtime provides the following standard output streams for MIDlets to return tracing data:

  • System.out

    Use the System.out stream to trace the activities of the MIDlet while it is running. For example, you can set a System.out event to be triggered when the user selects a certain menu item. To write a line of output data, use the System.out.println method.

  • System.err

    Use the System.err stream to display error messages and other important information. To write a line of output data, use the System.err.println method.

System.out and System.err outputs are generated both in the emulator and on the device.

Monitoring in an emulator

To monitor the MIDlet in an emulator:

  1. Run the MIDlet in the emulator. You can run the MIDlet by launching it directly from the emulator, from an IDE integrated with the emulator, or from the command line.

    For more information about different launch options, see the SDK documentation.

  2. Open the diagnostics window to access the diagnostics and tracing data for the MIDlet.

Monitoring on a Symbian device with JRT 2.1 or newer

Note: Make sure to use the correct SDK release for the device. The SDK platform must support the same Java Runtime version as the device. For example, if you want to monitor the MIDlet on a device with Java Runtime 2.1 or 2.2, use a Symbian^3 SDK.

To monitor the MIDlet on a Symbian device with Java Runtime 2.1 or newer:

  1. Connect the device to your computer. The supported connection types are Bluetooth, USB, and WLAN. For more information about establishing a connection, see the SDK documentation.

  2. Install the EcmtAgent onto the device.

  3. On the device, launch the EcmtAgent, and select the appropriate connection type from Options > Settings > Bearer.

  4. On the computer, launch the Device Connectivity Tool.

  5. In the Device Connectivity Tool, select the correct connection, and click Connect. After the connection is established, the EcmtAgent and Device Connectivity Tool both change their status to "Connected".

  6. Open your IDE, open the MIDlet project, and set the SDK configuration to SymbianDevice.

  7. Launch the MIDlet from the IDE. The MIDlet is installed onto the device, where you can now test it.

    Tip: You can also launch the MIDlet from the command line. For more information, see the SDK documentation.

  8. To access the diagnostics and tracing data for the MIDlet, open the diagnostics window from the Device Connectivity Tool by selecting Tools > Diagnostics.

    Tip: You can also view the tracing data in the IDE console. If you launched the MIDlet from the command line, the command console also shows the tracing data.

  9. After you have finished testing the MIDlet, close it on the device. The MIDlet is uninstalled from the device.

The following figure shows the diagnostics and tracing setup for Symbian^3 devices.

Figure: Diagnostics and tracing setup for Symbian^3

Monitoring on older Symbian devices

Note: Make sure to use the correct SDK release for the device. The SDK platform must match the device platform. For example, if you want to monitor the MIDlet on an S60 3rd Edition FP2 device, use an S60 3rd Edition FP2 SDK.

To monitor the MIDlet on an S60 5th Edition device with Java Runtime 1.x, or on an S60 3rd Edition FP2 or earlier device:

  1. Connect the device to your computer. The supported connection types are Bluetooth, USB, and WLAN. For more information about establishing a connection, see the SDK documentation.

  2. Install the EcmtAgent onto the device. The installation additionally stores the RedMIDlet.jar file in the installation files folder on the device.

  3. On the device, open the application manager, and install the RedMIDlet.

  4. On the device, launch the EcmtAgent, and select the appropriate connection type from Options > Settings > Bearer.

  5. On the computer, launch the Device Connectivity Tool.

  6. In the Device Connectivity Tool, select the correct connection, and click Connect. After the connection is established, the EcmtAgent and Device Connectivity Tool both change their status to "Connected".

  7. On the device, launch the RedMIDlet. Any tracing data is now redirected to the computer.

    Note: Keep the EcmtAgent running in the background.

  8. Open your IDE, open the MIDlet project, and set the SDK configuration to SymbianDevice.

  9. Launch the MIDlet from the IDE. The MIDlet is installed onto the device, where you can now test it.

    Tip: You can also launch the MIDlet from the command line. For more information, see the SDK documentation.

  10. To access the diagnostics and tracing data for the MIDlet, open the diagnostics window from the Device Connectivity Tool by selecting Tools > Diagnostics.

    Tip: You can also view the tracing data in the IDE console. If you launched the MIDlet from the command line, the command console also shows the tracing data.