Working with the Hyades JSR-047 Logging Sample

Introduction

This sample demonstrates the Hyades support for logging Common Base Events using JSR-047 logging APIs implemented in JDK 1.4.0 or above. Users experience logging Common Base Events to the console and a Logging Agent. The Logging Agent may be monitored via the IBM Agent Controller and the workbench.


Contents

The contents of the sample include the Java source code, dependencies and configuration file necessary to log Common Base Events to a JSR-047 logger implemented in JDK 1.4.0 or above (i.e. java.util.logging).


Requirements

JDK 1.4.0 or above (not supplied) is required to compile and execute this sample.


Assumptions
  1. When either launching this application from the Profiling Perspective of the workbench or attaching to a Logging Agent using the workbench, the Agent Controller is installed and running.
  2. When launching this application from the Profiling Perspective of the workbench, the Agent Controller is configured during installation to use JDK 1.4.0 or above.

Dependencies

The following JAR files are required to compile and execute this sample:

Execution Steps

To run this sample execute the following steps in order:
  1. Enable the newly created Java project (i.e. HyadesLoggingJava14Project) to compile and execute using JDK 1.4.0 or above (Project >> Properties >> Java Build Path >> Libraries >> Add Library >> JRE System Library >> [JDK 1.4.0 or above] >> Finish >> OK).
  2. Confirm that all compilation errors have been fixed.
  3. Enable logging in the Profiling and Logging preferences (Window >> Preferences >> Profiling and Logging >> Enable logging >> OK).
  4. Add the 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' logging agent to the Profiling and Logging preferences (Window >> Preferences >> Profiling and Logging >> Logging Agents >> New agent >> org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample >> Add agent >> OK).
  5. Start the IBM Agent Controller service (i.e. Windows) or daemon (i.e. UNIX).
  6. Run the sample class (Run >> Run As >> Java Application >>Run).
  7. Attach to the 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' logging agent in the Profiling Perspective (Profile >> Attach >> Java Process >> 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' >> Finish).
  8. Start monitoring the 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' logging agent (Profile >> Start Monitoring).
  9. Open the Log View in the Profiling Perspective to view the logged Common Base Event log records (Window >> Show View >> Log View).
  10. Refresh Log View in the Profiling Perspective (Profile >> Refresh Views).
  11. Alternatively, launch the sample class through the Profiling Perspective (Profile >> Launch >> Java Process >> Project >> Browse >> 'HyadesLoggingJava14Project' >> Main class >> Search >> 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' >> Finish).
  12. Open the Log View in the Profiling Perspective to view the logged Common Base Event log records (Window >> Show View >> Log View).
  13. Refresh Log View in the Profiling Perspective (Profile >> Refresh Views).