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:Please 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:
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, the Agent Controller must be installed on the system
where the Generic Log Adapter is to run and it must be started before the
Generic Log Adapter is started.
Windows batch file:
@rem USAGE: runregex @rem PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) run-time using an example adapter file and sample log file. @rem INSTRUCTIONS: When executing in a GLA run-time environment, change the value of the %GLA_HOME% environment variable to the absolute path of the unzipped GLA run-time. @rem NOTE: When executing in a plug-in (e.g. Eclipse) run-time environment, create a temporary working directory and change the value of the %GLA_HOME% environment variable to the @rem absolute path of the new temporary working directory. Furthermore, create a %GLA_HOME%\config directory and copy the contents of the org.eclipse.hyades.logging.adapter.config @rem plug-in to the new %GLA_HOME%\config directory. Finally, create a %GLA_HOME%\lib directory and copy the following JAR files to the new %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 MY_DIRECTORY=MyAdapter SET CONFIG_FILE=%GLA_HOME%\config\%MY_DIRECTORY%\myadapter.adapter PUSHD %GLA_HOME%\config\%MY_DIRECTORY%\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_example.sh # PURPOSE: Illustrates the functional capabilities of the Generic Log Adapter (GLA) run-time using an example adapter file and sample log file. # INSTRUCTIONS: When executing in a GLA run-time environment, change the value of the $GLA_HOME environment variable to the absolute path of the unzipped GLA run-time. # NOTE: When executing in a plug-in (e.g. Eclipse) run-time environment, create a temporary working directory and change the value of the $GLA_HOME environment variable to the # absolute path of the new temporary working directory. Furthermore, create a $GLA_HOME/config directory and copy the contents of the com.ibm.etools.logging.adapter.config # plug-in to the new $GLA_HOME/config directory. Finally, create a $GLA_HOME/lib directory and copy the following JAR files to the new $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 YOUR_DIRECTORY=MY_DIRECTORY export MY_DIRECTORY CONFIG_FILE="$GLA_HOME/config/$MY_DIRECTORY/myadapter.adapter" export CONFIG_FILE CUR_DIR=`pwd` export CUR_DIR cd "$GLA_HOME/config/$MY_DIRECTORY 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 Hyades 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.