Working with the Hyades Apache Commons Logging Sample

Introduction

This sample demonstrates the Hyades support for logging Common Base Events using the Apache Commons logging APIs. Users experience logging Common Base Events to a Logging Agent. The Logging Agent may be monitored via the Hyades Data Collection Engine application or service and the Hyades workbench.


Contents

The contents of the sample include the Java source code and dependencies necessary to log Common Base Events to an Apache Commons logger.


Assumptions
  1. When either launching this application from the Profiling and Logging Perspective of the workbench or attaching to a Logging Agent using the workbench, the Hyades Data Collection Engine application or service is configured and running.

Dependencies

The JAR files that are listed in the table are required to execute this sample:

JAR file Plug-in it is contained in Reason for requirement
hexr.jar org.eclipse.hyades.execution.remote Hyades Logging Agent
hlcore.jar org.eclipse.hyades.logging.core Common Base Event's Hyades Logging Core dependency
hlcbe101.jar org.eclipse.hyades.logging.core Common Base Event implementation
hlcommons.jar org.eclipse.hyades.logging.commons Hyades support for Apache Commons logging APIs
commons-logging.jar org.apache.jakarta_commons_logging Apache Commons logging APIs
ecore.jar org.eclipse.emf.ecore Common Base Event's Eclipse Modeling Framework (EMF) dependency
common.jar org.eclipse.emf.common Common Base Event's Eclipse Modeling Framework (EMF) dependency

Execution Steps

To run this sample and manually attach to the Logging Agent, follow these steps:
  1. Confirm that all compilation errors have been fixed.
  2. Start the Hyades Data Collection Engine application or service.
  3. Enable logging in the Profiling and Logging preferences (Window > Preferences... > Profiling and Logging > Enable logging > OK).
  4. Run the sample class from the Java Perspective (Run > Run... > Java Application > New... > Main class > Search... > HyadesLoggingCommonsSample > OK > Run).
  5. Open the Profiling and Logging Perspective (Window > Open Perspective > Other... > Profiling and Logging).
  6. Attach to the 'HyadesLoggingCommonsSample' Logging Agent in the Profiling and Logging Perspective (Run > Profile... > Attach - Java Process > New > Agents > HyadesLoggingCommonsSample > Profiling > Destination > Profiling project > Browse... > 'HyadesLoggingCommonsProject' > OK > Run).
  7. Start monitoring the 'HyadesLoggingCommonsSample' Logging Agent (<right-click the 'HyadesLoggingCommonsSample' Logging Agent> > Start Monitoring).
  8. Open the Log View in the Profiling and Logging Perspective to view the logged Common Base Event log records (Window > Show View > Other... > Profiling and Logging > Log View > OK).
  9. Refresh Log View in the Profiling and Logging Perspective (<right-click the 'HyadesLoggingCommonsSample' Logging Agent> > Refresh).
Alternatively, to run this sample and automatically attach to the Logging Agent, follow these steps:
  1. Confirm that all compilation errors have been fixed.
  2. Start the Hyades Data Collection Engine application or service.
  3. Enable logging in the Profiling and Logging preferences (Window > Preferences... > Profiling and Logging > Enable logging > OK).
  4. Add the 'HyadesLoggingCommonsSample' Logging Agent to the Profiling and Logging preferences (Window > Preferences... > Profiling and Logging > Logging Agents > New agent > HyadesLoggingCommonsSample > Add agent > OK).
  5. Open the Profiling and Logging Perspective (Window > Open Perspective > Other... > Profiling and Logging).
  6. Run the sample class from the Profiling and Logging Perspective (Run > Profile... > Java Application > New... > Main class > Search... > HyadesLoggingCommonsSample > OK > Run).
  7. Open the Log View in the Profiling and Logging Perspective to view the logged Common Base Event log records (Window > Show View > Other... > Profiling and Logging > Log View > OK).
  8. Refresh Log View in the Profiling and Logging Perspective (<right-click the 'HyadesLoggingCommonsSample' Logging Agent> > Refresh).