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 IBM Agent Controller and the 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
- 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.
Dependencies
The following JAR files are required to compile and execute
this sample:
- hexr.jar - org.eclipse.hyades.execution.remote
- hlcore.jar - org.eclipse.hyades.logging.core
- hlevents.jar - org.eclipse.hyades.logging.core
- hlcommons.jar - org.eclipse.hyades.logging.commons
- commons-logging.jar - Apache Commons
Execution Steps
To run this sample execute the following steps in order:
- Confirm that all compilation errors have been fixed.
- Enable logging in the Profiling and Logging
preferences (Window >> Preferences >> Profiling and Logging
>> Enable logging >> OK).
- Add the 'org.eclipse.hyades.logging.commons.sample.HyadesLoggingCommonsSample'
logging agent to the Profiling and Logging preferences (Window
>> Preferences >> Profiling and Logging >> Logging Agents
>> New agent >> org.eclipse.hyades.logging.commons.sample.HyadesLoggingCommonsSample >> Add agent >> OK).
- Start the IBM Agent Controller service (i.e. Windows) or daemon (i.e. UNIX).
- Run the sample class (Run >> Run As >> Java Application
>>Run).
- Attach to the 'org.eclipse.hyades.tests.logging.commons.sample.HyadesLoggingCommonsSample'
logging agent in the Profiling Perspective (Profile >> Attach >> Java Process >> 'org.eclipse.hyades.tests.logging.commons.sample.HyadesLoggingCommonsSample' >> Finish).
- Start monitoring the 'org.eclipse.hyades.tests.logging.commons.sample.HyadesLoggingCommonsSample' logging agent (Profile >> Start Monitoring).
- Open the Log View in the Profiling Perspective to view the logged Common Base Event log records (Window >> Show View >> Log View).
- Refresh Log View in the Profiling Perspective (Profile >> Refresh Views).
- Alternatively, launch the sample class through the Profiling Perspective (Profile >> Launch >> Java Process >> Project >> Browse >> 'HyadesLoggingCommonsProject' >> Main class >> Search >> 'org.eclipse.hyades.tests.logging.commons.sample.HyadesLoggingCommonsSample' >> Finish).
- Open the Log View in the Profiling Perspective to view the logged Common Base Event log records (Window
>> Show View >> Log View).
- Refresh Log View in the Profiling Perspective (Profile >> Refresh
Views).