Working with the Common Logging Sample

Introduction

This sample demonstrates the usage of the Common Logging Strategy implementation in an Eclipse environment by logging records in a Common Logging Sample plug-in. Users experience creating and configuring Eclipse log records (e.g. IStatus) and Common Base Event log records, and logging the newly created log records through a plug-in's logger configured for writing to the Common Logging Logger Logging Agent and the Eclipse Common Logging XML log file (<workspace>/.metadata/CommonBaseEvent.log). The Common Logging Logger Logging Agent may be monitored via the Data Collection Engine service or daemon and the Hyades workbench.


Contents

The contents of the sample include the Java source code and dependencies necessary to demonstrate the usage of the Common Logging Strategy implementation in an Eclipse environment.


Requirements

  1. JRE 1.4.0 or above is required to compile and execute this sample.

Assumptions
  1. <workspace> represents the absolute path to the workbench's workspace.

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
logging.jar com.ibm.etools.common.logging Common Logging implementation
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
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
hexcore.jar org.eclipse.hyades.execution.core Hyades Logging Agent
hexr.jar org.eclipse.hyades.execution.remote Hyades Logging Agent dependency
hexl.jar org.eclipse.hyades.execution.local Hyades Logging Agent dependency
hl14.jar org.eclipse.hyades.logging.java14 Hyades support for JSR-047 logging APIs

Execution Steps

To run this sample , follow these steps:
  1. If the workbench's default JRE is not 1.4.0 or above, modify the newly created Java project (i.e. CommonLoggingProject) to compile and execute using JRE 1.4.0 or above .
    1. Select the CommonLoggingProject, right-click and select Properties.
    2. In the properties dialog, select Java Build Path from the list in the left pane.
    3. Under the Libraries tab, select JRE_LIB and click the Remove button.
    4. To add the new JRE, click the Add Library button.
    5. In the Add Library dialog, select the JRE System Library from the list and click Next.
    6. Select the Alternate JRE option, and click Installed JREs to add a JRE. The preferences dialog for Installed Java Runtime Environments opens.
    7. Click Add.
    8. On the Add JRE dialog, specify the name and home directory of the JRE 1.4.0. Click OK.
    9. Click OK.
    10. Click Finish.
    11. Click OK in the properties dialog.
  2. Confirm that all compilation errors have been fixed.
  3. Before running this sample, add the required plug-ins to the search path of the Workbench then create a run-time instance of the Workbench.
  4. Run the Common Logging Sample by selecting the Common Logging Sample file menu by selecting Common Logging Sample > Run or toolbar button 'green circle' icon.