This appendix includes the following sections:
The following examples are located in the AdaptersExamples
subdirectory of the installation location.
Flat File Writer
Using the Oracle GoldenGate Flat File Adapter to convert Oracle GoldenGate trail data to text files.
Message Delivery
Using the Oracle GoldenGate Java Adapter to send JMS messages with a custom message format.
Using the Oracle GoldenGate Java Adapter to send JMS messages with custom message header properties.
Message Capture
Using the Oracle GoldenGate Java Adapter to process JMS messages, creating an Oracle GoldenGate trail.
Java User Exit API
Using the Oracle GoldenGate Java Adapter API to write a custom event handler.
This example explains how to configure logging for release 11.2.1 or later Oracle GoldenGate Adapters user exits. The first section configures a typical Extract pump, which triggers the logging defaults. The second section explains how to customize the logging implementation.
The following Oracle GoldenGate Java user exit Extract example configuration triggers the logging defaults.
Extract Parameter File
EXTRACT jms1 SOURCEDEFS dirdef/aa.def CUSEREXIT libggjava_ue.so CUSEREXIT PASSTHRU INCLUDEUPDATEBEFORES GETUPDATEBEFORES TABLE GG.*;
Properties file
The associated property file is named for the Extract group, jms1.properties
. All JNI properties have default values and thus do not need to be specified, so this is a complete properties file.
gg.handlerlist=my_jms gg.handler.my_jms.type=jms gg.handler.my_jms.destination=dynamicQueues/testQ1 gg.handler.my_jms.format=xml2 gg.handler.my_jms.mode=op gg.handler.my_jms.connectionFactory=ConnectionFactory gg.java.naming.provider.url=tcp://localhost:61616 gg.java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory gg.classpath=/opt/activemq/activemq-all.jar
The Resulting Log File
The log file will be created when you add and start the Extract in GGSCI, For example:
ggsci> ADD EXTRACT jms1, EXTRAILSOURCE dirdat/aa ggsci> START MGR ggsci> START EXTRACT jms1
The log file is written to the same directory as the report file. It is named for the Extract group. For Example:
$ ls -l dirrpt/ total 48 -rw-rw-rw- 1 1685 Apr 16 20:38 MGR.rpt -rw-rw-rw- 1 1685 Apr 16 20:38 jms1.rpt -rw-rw-rw- 1 21705 Apr 19 13:59 jms1_info_0.log.0 -rw-rw-rw- 1 0 Apr 19 13:58 jms1_info_0.log.0.lck
This example describes how to customize the logging for 11.2.1 and later Oracle GoldenGate user exit adapters by using one of two methods:
Use Java adapter user exit properties
gg.log={ jdk | logback | log4j } gg.log.level={ info | debug | trace } gg.log.classpath={ classpath for logging }
If the log implementation property gg.log
is not set, the jdk
option defaults. This specifies that java.util.logging
(JUL
) is used. The log level defaults to info
. To customize this, you can set the gg.log
to either:
log4j
- This automatically configures the class path to include the Log4j and appropriate slf4j-log4j
binding.
logback
- To use the logback
option, the logback jars must be manually downloaded and copied into the install directory. The class path is still automatically configured as long as the jars are copied into the predefined location. See ggjava/resources/lib/optional/logback/ReadMe-logback.txt
for more information.
Use JVM options
Instead of using default logging or setting logging properties, jvm.bootoptions
can be used to define the logging. To do this, set jvm.bootoptions
to include the system property that defines the configuration file by doing one of the following:
Specify a log4j configuration file:
jvm.bootoptions=-Dlog4j.configuration=my-log4j.properties
This implicitly sets gg.log
to log4j
as the type of logging implementation and appends slf4j-log4j12
binding to the class path.
Specify a java.util.logging
properties file or class:
jvm.bootoptions=-Djava.util.logging.config.file=my-logging.properties
This implicitly sets gg.log=jdk
, which specifics java.util.logging
(JUL
). It appends slf4j-jdk14
binding to the class path.
First, download and copy logback-core-jar
and logback-classic-jar
into ggjava/resources/lib/optional/logback.
Then specify a logback configuration file:
jvm.bootoptions=-Dlogback.configuationFile=my-logback.xml
This implicitly sets gg.log=logback
and appends logback-classic
and logback-core
to the class path.
These are implicit settings of gg.log
and gg.log.classpath
that will be overridden by an explicit setting of either of these properties in the property file. The logging class path will also be overridden by setting the JVM class path to include specific jars, such as:
jvm.bootoptions=...-Djava.class.path=mypath/my1.jar:mypath2/my2.jar...
Note:
Setting the JVM class path to includespecific jars may cause duplicate, possibly conflicting, impleentations in the class path.