This sample demonstrates the Hyades support for logging Common Base Events (CBEs) using JSR-047 logging APIs implemented in JDK 1.4.0 or above (i.e. java.util.logging). Users experience logging CBEs to the console and 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, dependencies (excluding java.util.logging classes) and configuration file necessary to log CBEs to a JSR-047 logger implemented in JDK 1.4.0 or above (i.e. java.util.logging).
Requirements
JRE 1.4.0 or above (i.e. java.util.logging) is required to compile and execute this sample.
Assumptions
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.
When launching
this application from the Profiling and Logging Perspective of the workbench, the
Hyades Data Collection Engine application or service is configured to use JRE 1.4.0 or
above.
<workspace> represents the absolute path to the Hyades' workspace.
The 'java.util.logging.config.file' environment variable is set to the JSR-047 logging's (i.e. java.util.logging) configuration file's (HyadesLoggingJava14Sample.properties) absolute path and name. For example, <workspace>/HyadesLoggingJava14Project/cfg/HyadesLoggingJava14Sample.properties.
Dependencies
The following JAR files are required to compile and execute
this sample:
JAR file
Plug-in it is contained in
hexr.jar
org.eclipse.hyades.execution.remote
hl14.jar
org.eclipse.hyades.logging.java14
hlcore.jar
org.eclipse.hyades.logging.core
hlevents.jar
org.eclipse.hyades.logging.core
Execution Steps
To run this sample, follow these steps:
If the workbench's default JRE is not 1.4.0 or above, modify the newly created Java project (i.e. HyadesLoggingJava14Project) to compile and execute using JRE 1.4.0 or above (Project > Properties > Java Build Path > Libraries > JRE_LIB > Remove > Add Library... > JRE System Library > [JRE 1.4.0 or above] > Finish > OK).
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.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).
Start the Hyades Data Collection Engine application or service.
Run the sample class (Run > Run... > Java Application > New > 'HyadesLoggingJava14Project' > Arguments > VM arguments > '-Djava.util.logging.config.file=<workspace>/HyadesLoggingJava14Project/cfg/HyadesLoggingJava14Sample.properties' > Run).
Attach to the 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' logging agent in the Profiling and Logging Perspective (Profile > Attach > Java Process > org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample > Next > > Profiling project > Browse... > 'HyadesLoggingJava14Project' > OK > Finish).
Start monitoring the 'org.eclipse.hyades.logging.java.sample.HyadesLoggingJava14Sample' logging agent (Profile > Start Monitoring).
Open the Log View in the Profiling and Logging Perspective to view the logged CBE log records (Window > Show View > Other... > Profiling and Logging > Log View > OK).
Refresh Log View in the Profiling and Logging Perspective (Profile > Refresh Views).
Alternatively, launch the sample class through the Profiling and Logging Perspective (Profile > Launch > Java Process > Project > Browse... > 'HyadesLoggingJava14Project' > OK > Main class > Search... > 'HyadesLoggingJava14Sample' > OK > VM arguments > '-Djava.util.logging.config.file=<workspace>/HyadesLoggingJava14Project/cfg/HyadesLoggingJava14Sample.properties' > Finish).
Open the Log View in the Profiling and Logging Perspective to view the logged CBE log records (Window > Show View > Other... > Profiling and Logging > Log View > OK).
Refresh Log View in the Profiling and Logging Perspective (Profile > Refresh Views).