After you create a plug-in project to contain the artifacts for a log parser, you need to configure the plug-in so that it can be used by the Log and Trace Analyzer. Follow these steps:
The following plug-in dependencies must be included in the plug-in manifest file. Open the plugin.xml file in a text editor and add the following lines after the runtime element:
<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>
You need to define an extension point for each type of application log file that you want to parse and import into the Log and Trace Analyer. Below is a sample extension point for the MyApp application with both a rules adapter and static adapter defined:
<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>
To customize the extension point for your log parser, the updates need to be made:
<parserParameter name="Default" value="./MyAdapter/myadapter.adapter">
The fields specified above will create an option for MyApp myapp.log
in the Import Log wizard as shown below:
You can use a plugin.properties file to define certain properties in the plugin.xml file that may need to have different versions. For example, if there are text strings that will be included on the Import Log File wizard that need to be translated to different languages, they can be defined in the plugin.properties file and you can include different properties files for the languages you want to support. In the plugin.properties file you define substitution variables that can be used in the plugin.xml file. The plugin.properties file for the above plugin.xml would look like this:
# 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
Create a static wrapper class that extends the org.eclipse.hyades.logging.adapter.config.StaticParserWrapper. This class is used for both static and rules-based parsers. Create the class in the log parser plug-in project. You can use the example class below by replacing RulesParser with the name of your log parser plug-in project.
/*
* 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";
}
}
To verify that you have correctly configured the plug-in manifest file, you can run your plug-in project in a new run-time workbench. Follow these steps:
To deploy your log parser plug-in to an eclipse workbench you need to package the plug-in files by exporting them to a zip file. Follow these steps:
<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>
bin.includes = MyAdapters/,\ config/,\ plugin.xml,\ plugin.properties,\ parsers.jar source.parsers.jar = src/ output.parsers.jar = bin/
You can deploy your log parser plug-in by unzipping the zip file you just created in the plugin directory of an eclipse installation. You are now ready to test your newly created log parser plug-in using the Log and Trace Analyzer.
Related Concepts
Related tasks
Creating a log parser
Creating a static adapter
Creating a rules-based adapter
Testing a log parser
Setting up a plug-in project for a log parser
Related references
Adapter Configuration File structure
Adapter Configuration Editor
Regular expression grammar
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.