El Adaptador de anotaciones genérico proporciona una clase de productor que permite que los objetos de suceso base común que genera el adaptador se envíen a un agente de anotaciones. Se puede utilizar el Analizador de anotaciones y rastreo para conectar al agente de anotaciones, lo que permite supervisar y analizar las anotaciones de aplicación en tiempo real.
Requisitos previos:Para configurar el adaptador para la supervisión, siga los pasos que se indican a continuación:
Nota: Cuando se crea un nuevo archivo de configuración del adaptador, se configura para utilizar la clase
CBELogOutputter por omisión. Si no ha cambiado este valor, puede saltarse este procedimiento.
El componente productor del archivo de configuración del adaptador se debe actualizar para utilizar la clase
CBELogOutputter que escribe los objetos de suceso base común en un agente de anotaciones. Puede actualizar el componente productor existente, o bien, añadir un nuevo componente productor.
Para añadir un nuevo componente productor:
Nombre: | Nombre del productor en el contexto |
Descripción: | Descripción de lo que hace el productor |
Clase ejecutable: | org.eclipse.hyades.logging.adapter.outputters.CBELogOutputter |
Nivel de anotaciones | Nivel de anotaciones internas que debe utilizar el componente productor.
Un valor de 99 significa que el productor no va a anotar ningún mensaje. Un valor de 0 significa que el productor va a anotar mensajes de todos los niveles de gravedad. El valor que se recomienda es 50, puesto que significa que sólo se van a anotar los mensajes de error del productor internos Críticos y Muy graves. |
Rol: | Productor |
ID exclusivo: | Debe señalar al productor que se ha definido en la Instancia de contexto en el paso 3. Utilice el botón Examinar para seleccionar el ID correcto. |
Si desea que el analizador de anotaciones supervise el archivo de anotaciones de forma continua, debe actualizar las propiedades de la instancia de contexto del archivo de configuración del adaptador para la operación continua.
El adaptador de anotaciones que ha creado se puede ejecutar de forma externa desde un archivo de proceso por lotes en el entorno Windows, o bien, en un script de shell en entornos que no son de Windows. Más abajo se incluyen archivos de ejemplo que se pueden utilizar para iniciar el proceso Java que va a ejecutar el adaptador de anotaciones.
Nota: Para conectar y supervisar el agente de anotaciones que ha creado el Adaptador de anotaciones genérico, se debe instalar un controlador de agentes Hyades en el sistema en el que se va a ejecutar el Adaptador de anotaciones genérico, y se debe iniciar antes de iniciar el Adaptador de anotaciones genérico.
Archivo de proceso por lotes de Windows:
@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%" POPDArchivo de proceso por lotes que no es de Windows:
#!/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 el archivo según proceda para iniciar el proceso Java que va a ejecutar el adaptador.
Ahora ya está preparado para supervisar las anotaciones de aplicación en tiempo real.
Conceptos relacionados
Visión general del Adaptador de anotaciones genérico
Especificación del formato de suceso base común
Tareas relacionadas
Crear un analizador de anotaciones
Consultas relacionadas
Estructura del archivo de configuración del adaptador
Editor de configuraciones de adaptador
Gramática de las expresiones regulares
(C) Copyright IBM Corporation 2000, 2005. Reservados todos los derechos.