로그 구문 분석기에 대한 아티팩트를 포함하기 위한 플러그인 프로젝트를 작성한 후, 이 플러그인을 구성하여 로그 및 추적 분석기에서 사용될 수 있도록 해야 합니다. 다음 단계를 따르십시오.
다음 플러그인 종속성이 플러그인 Manifest 파일에 포함되어야 합니다. 텍스트 편집기로 plugin.xml 파일을 열고 runtime 요소 다음에 다음 행을 추가하십시오.
<requires> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.core.runtime.compatibility"/> <import plugin="org.eclipse.hyades.logging.adapter"/> <import plugin="org.eclipse.hyades.logging.parsers"/> <import plugin="org.eclipse.hyades.logging.adapter.config"/> </requires>
구문 분석하고 로그 및 추적 분석기로 가져오려는 응용프로그램 로그 파일의 각 유형에 대해 확장점을 정의해야 합니다. 다음은 규칙 어댑터 및 정적 어댑터가 모두 정의된 MyApp 응용프로그램에 대한 샘플 확장점입니다.
<extension
point="org.eclipse.hyades.logging.parsers.logParser">
<parser
name="Sample Rules Adapter for MyApp"
icon=""
description="%STR_MYAPP_PARSER_DESCRIPTION"
class="RulesParser.StaticParserExtension"
ui_name="MyApp myapp.log file"
id="org.eclipse.hyades.logging.parsers.MyAppLogParser">
<field
useBrowse="true"
defaultValue="d:\temp\sample.log"
name="Directory"
helpContextId=""
tooltip="%STR_MYAPP_TOOLTIP1"
id="file_path"
browseType="*.log">
</field>
<field
useBrowse="false"
defaultValue="MyApp 1.0(rules), MyApp 1.0(static)"
name="Supported versions"
helpContextId=""
tooltip="%STR_MYAPP_TOOLTIP2"
ui_type="combobox"
id="version">
</field>
<parserParameter
name="MyApp 1.0(rules)"
value="./MyAdapter/myadapter.adapter">
</parserParameter>
<parserParameter
name="MyApp 1.0(static)"
value="./MyAdapter/mystaticadapter.adapter">
</parserParameter>
</parser>
</extension>
로그 구문 분석기에 대한 확장점을 사용자 정의하려면 갱신사항을 작성해야 합니다.
<parserParameter
name="Default"
value="./MyAdapter/myadapter.adapter">
</parserParameter>
위에 지정된 필드는 아래와 같이 로그 가져오기 마법사의 MyApp myapp.log에 대한 옵션을
작성합니다.
plugin.properties 파일을 사용하여 서로 다른 버전을 가질 필요가 있을 수 있는 plugin.xml 파일의 특정 특성을 정의할 수 있습니다. 예를 들어, 여러 언어로 변환될 필요가 있으며 로그 파일 가져오기 마법사에 포함될 텍스트 문자열이 있는 경우, 이를 plugin.properties 파일에 정의할 수 있으며 지원하려는 언어에 대한 여러 특성 파일을 포함시킬 수 있습니다. 이 plugin.properties 파일에서 plugin.xml 파일에 사용할 수 있는 대체 변수를 정의합니다. 위의 plug.xml에 대한 plugin.properties 파일은 다음과 같습니다.
# Properties for RulesParser Plugin pluginName = RulesParser providerName = MyCompany # logParser extension point message(s): STR_MYAPP_PARSER_DESCRIPTION = MyApp rules parser v1.0 STR_MYAPP_TOOLTIP1 = Enter the location of the log file STR_MYAPP_TOOLTIP2 = Select the version of the log file to import
org.eclipse.hyades.logging.adapter.config.StaticParserWrapper를 확장하는 정적 랩퍼 클래스를 작성하십시오. 이 클래스는 정적 및 규칙 기반 구문 분석기 둘 다에 사용됩니다. 로그 구문 분석기 플러그인 프로젝트에 이 클래스를 작성하십시오. RulesParser를 로그 구문 분석기 플러그인 프로젝트의 이름으로 바꾸고 아래의 예제 클래스를 사용할 수 있습니다.
/*
* Created on Apr 12, 2004
* StaticParserExtension class created to be used in RulesParser Plug-in
*/
package RulesParser;
import org.eclipse.hyades.logging.adapter.config.StaticParserWrapper;
/**
* @author developer
* StaticParserExtension class
*/
public class StaticParserExtension extends StaticParserWrapper {
public StaticParserExtension(){
super();
currentPlugin="RulesParser";
}
}
플러그인 Manifest 파일을 올바로 구성했는지 검증하려면 새 런타임 Workbench에서 플러그인 프로젝트를 실행할 수 있습니다. 다음 단계를 수행하십시오.
로그 구문 분석기 플러그인을 Eclipse Workbench에 전개하려면 플러그인 파일을 zip 파일로 내보냄으로써 플러그인 파일을 패키지해야 합니다. 다음 단계를 수행하십시오.
<runtime> <library name="parsers.jar"> <export name="*"/> </library> </runtime>
<?xml version="1.0" encoding="UTF-8"?>
<PluginConfiguration>
<Application configuration="default"
executable="RemoteLogParserLoader"
extends="default"
location="%RASERVER_HOME%\plugins\RulesParser_1.0.0"
path="%JAVA_PATH%">
<Variable name="CLASSPATH"
position="prepend"
value="%RASERVER_HOME%\plugins\RulesParser_1.0.0\parsers.jar"/>
</Application>
<Option name="RulesParser" type="version" value="1.0.0"/>
</PluginConfiguration>
<Variable name="GLA_CONFIG_PATH" position="append" value="%RASERVER_HOME%\plugins\PARSER_PLUGIN\config"/> <Parameter position="append" value="config_path=%GLA_CONFIG_PATH%"/>여기서 PARSER_PLUGIN은 확장 중인 로그 구문 분석기의 디렉토리입니다. 새 <Variable> 요소는 <Application> 요소의 첫 번째 하위 노드로 추가되어야 하며 새 <Parameter> 요소는 <Application> 요소의 마지막 하위 노드로 추가되어야 합니다.
bin.includes = MyAdapters/,\ config/,\ plugin.xml,\ plugin.properties,\ parsers.jar source.parsers.jar = src/ output.parsers.jar = bin/
Eclipse 설치의 플러그인 디렉토리에 작성한 Zip 파일을 압축 해제하여 로그 구문 분석기 플러그인을 전개할 수 있습니다. 이제 로그 및 추적 분석기를 사용하여 새로 작성된 로그 구문 분석기 플러그인을 테스트할 수 있습니다.
ㅅ로그 구문 분석기 플러그인을 원격 시스템에 전개하여 로그 파일을 원격으로 가져올 수 있게 하려면, 원격 시스템의 Agent Controller 설치 디렉토리에 방금 작성한 Zip 파일을 압축 해제(unzip)하십시오.
관련 개념
관련 타스크
로그 구문 분석기 작성
정적 어댑터 작성
규칙 기반 어댑터 작성
로그 구문 분석기 테스트
로그 구문 분석기에 대한 플러그인 프로젝트 설정
관련 참조
어댑터 구성 파일 구조
어댑터 구성 편집기
정규 표현식 문법
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.