The Generic Log Adapter provides an outputter class that allows the Common Base Event objects generated by your adapter to be sent to a logging agent. The Log and Trace Analyzer can be used to attach to the logging agent, to monitor and to analyze the application log in real time.
Prerequisites:Follow these steps to configure your adapter for monitoring.
Note: When a new adapter configuration file is created, it is configured to use the
CBELogOutputter class by default. If you have not changed this setting,
you can skip this procedure.
The outputter component in the adapter configuration file needs to be updated
to use the CBELogOutputter class which writes the Common Base Event objects
to a logging agent. You can either update the existing Outputter Component
or add a new Outputter component.
To add a new outputter component:
Name: | Outputter name in the context |
Description: | Description of what this outputter does |
Executable class: | org.eclipse.hyades.logging.adapter.outputters.CBELogOutputter |
Logging level: | The level of internal logging the outputter component should use.
A value of 99 means the outputter will not log any messages. A value of 0 means the outputter will log messages of all severities. The recommended value is 50 which means that only Critical or Fatal internal outputter errors messages are logged. |
Role: | Outputter |
UniqueID: | Must point to the outputter defined in the Context Instance in step 3. Use the Browse button to select the correct ID. |
If you want the log parser to monitor the log file continuously, you need to update the context instance properties of the adapter configuration file for continuous operation.
The log adapter you created can be run externally
from a batch file in the Windows environment or a shell script
in non-Windows environments. Below are sample files that can
be used to launch the Java process that will run your log adapter.
Note: To attach and monitor the logging agent created by the Generic Log Adapter, a Hyades Agent Controller must be installed on
the system where Generic Log Adapter is to run and it must be started before Generic Log Adapter is started.
Windows batch file:
@rem USAGE: runregex @rem PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) @rem run-time using an example adapter file and sample log file. @rem ASSUMPTIONS: This batch file assumes the GLA run-time and required files are @rem stored in the following directory structure: @rem %GLA_HOME%\config - GLA adapter configuration files @rem %GLA_HOME%\lib - GLA run-time and required jars @rem %GLA_HOME%\schema - GLA adapter configuration schema files @rem INSTRUCTIONS: @rem If the GLA run-time and required files are stored as indicated in the @rem assumptions section above, change the value of the %GLA_HOME% @rem environment variable to the absolute path where the GLA run-time @rem and required files are stored. @rem If the GLA run-time files are stored in a plug-in (e.g. Eclipse) @rem environment, perform the following instructions: @rem 1) Create a temporary directory to store the GLA run-time and required files. @rem 2) Create the config, lib, and schema directories in the temporary @rem directory creatd in step 1) @rem 3) Change the value of the %GLA_HOME% environment variable to the @rem absolute path of the temporary directory created in step 1) @rem 4) Copy the adapter files you want to run into the %GLA_HOME%\config directory. @rem For example if you want to run the Apache adapter files then copy the @rem Apache directory of the org.eclipse.hyades.logging.adapter.config @rem plug-in and all of its contents to the %GLA_HOME%\config directory. @rem 5) Copy the contents of the schema directory of @rem org.eclipse.hyades.logging.adapter plug-in to the %GLA_HOME%\schema directory. @rem 6) Copy the following jar files to the %GLA_HOME%\lib directory @rem Plug-in | JAR @rem --------------------------------------------------- @rem org.eclipse.hyades.logging.adapter | hgla.jar @rem org.eclipse.hyades.logging.core | hlcbe101.jar @rem org.eclipse.hyades.logging.core | hlcore.jar @rem org.eclipse.hyades.execution.remote | hexr.jar @rem org.eclipse.emf.ecore | ecore.jar @rem org.eclipse.emf.common | common.jar SET GLA_HOME=d:\GenericLogAdapter SET CONFIG_FILE=%GLA_HOME%\config\my.adapter @PUSHD %GLA_HOME%\config\ java -DGLA_HOME="%GLA_HOME%" -classpath "%GLA_HOME%\lib\hgla.jar;%GLA_HOME%\lib\hexr.jar;%GLA_HOME%\lib\hlcbe101.jar;%GLA_HOME%\lib\ecore.jar;%GLA_HOME%\lib\common.jar;%GLA_HOME%\lib\hlcore.jar" org.eclipse.hyades.logging.adapter.Adapter -ac "%CONFIG_FILE%" -cc "%CONFIG_FILE%" POPDnon-Windows batch file:
#!/bin/sh # USAGE: runregex.sh # PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) # run-time using an example adapter file and sample log file. # ASSUMPTIONS: This shell file assumes the GLA run-time and required files are # stored in the following directory structure: # %GLA_HOME%/config - GLA adapter configuration files # %GLA_HOME%/lib - GLA run-time and required jars # %GLA_HOME%/schema - GLA adapter configuration schema files # INSTRUCTIONS: # If the GLA run-time and required files are stored as indicated in the # assumptions section above, change the value of the %GLA_HOME% # environment variable to the absolute path where the GLA run-time # and required files are stored. # If the GLA run-time files are stored in a plug-in (e.g. Eclipse) # environment, perform the following instructions: # 1) Create a temporary directory to store the GLA run-time and required files. # 2) Create the config, lib, and schema directories in the temporary # directory creatd in step 1) # 3) Change the value of the %GLA_HOME% environment variable to the # absolute path of the temporary directory created in step 1) # 4) Copy the adapter files you want to run to the %GLA_HOME%/config directory. # For example, if you want to run the Apache adapter files then copy the # Apache directory of the org.eclipse.hyades.logging.adapter.config # plug-in and all of its contents to the %GLA_HOME%/config directory. # 5) Copy the contents of the schema directory of # org.eclipse.hyades.logging.adapter plug-in to the %GLA_HOME%/schema directory. # 6) Copy the following jar files to the %GLA_HOME%/lib directory # Plug-in | JAR # --------------------------------------------------- # org.eclipse.hyades.logging.adapter | hgla.jar # org.eclipse.hyades.logging.core | hlcbe101.jar # org.eclipse.hyades.logging.core | hlcore.jar # org.eclipse.hyades.execution.remote | hexr.jar # org.eclipse.emf.ecore | ecore.jar # org.eclipse.emf.common | common.jar GLA_HOME=/home/eclipse/GenericLogAdapter export GLA_HOME CONFIG_FILE="$GLA_HOME/config/my.adapter" export CONFIG_FILE CUR_DIR=`pwd` export CUR_DIR cd "$GLA_HOME/config" java -DGLA_HOME="$GLA_HOME" -classpath "$GLA_HOME/lib/hgla.jar:$GLA_HOME/lib/hexr.jar:$GLA_HOME/lib/hlcbe101.jar:$GLA_HOME/lib/ecore.jar:$GLA_HOME/lib/common.jar:$GLA_HOME/lib/hlcore.jar" org.eclipse.hyades.logging.adapter.Adapter -ac "$CONFIG_FILE" -cc "$CONFIG_FILE" cd "$CUR_DIR"Configure the file as required to launch the Java process that will run your adapter.
You are now ready to monitor the live application log.
Related Concepts
Overview of the Generic Log Adapter
Common Base Event format specification
Related tasks
Creating a log parser
Related references
Adapter Configuration File structure
Adapter Configuration Editor
Regular expression grammar
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.