B Customizing Logging
This example describes how to customize the logging for 11.2.1 and greater Oracle GoldenGate adapters by using one of two methods:
-
Use Java adapter properties
gg.log={ jdk | logback | log4j } gg.log.level={ info | debug | trace } gg.log.classpath={ classpath for logging }If the log implementation property
gg.logis not set, thejdkoption defaults. This specifies thatjava.util.logging(JUL) is used. The log level defaults toinfo. To customize this, you can set thegg.logto either:-
log4j- This automatically configures the classpath to include the Log4j and appropriateslf4j-log4jbinding. -
logback- To use thelogbackoption, the logback JARS must be manually downloaded and copied into the install directory. The classpath is still automatically configured as long as the JARs are copied into the predefined location. Seeggjava/resources/lib/optional/logback/ReadMe-logback.txtfor more information.
-
-
Use JVM options
Instead of using default logging or setting logging properties,
jvm.bootoptionscan be used to define the logging. To do this, setjvm.bootoptionsto include the system property that defines the configuration file by doing one of the following:-
Specify a
log4jconfiguration file:jvm.bootoptions=-Dlog4j.configuration=my-log4j.propertiesThis implicitly sets
gg.logtolog4jas the type of logging implementation and appendsslf4j-log4j12binding to the classpath. -
Specify a
java.util.loggingproperties file or class:jvm.bootoptions=-Djava.util.logging.config.file=my-logging.propertiesThis implicitly sets
gg.log=jdk, which specificsjava.util.logging(JUL). It appendsslf4j-jdk14binding to the classpath. -
First, download and copy
logback-core-jarandlogback-classic-jarintoggjava/resources/lib/optional/logback.Then specify a logback configuration file:jvm.bootoptions=-Dlogback.configuationFile=my-logback.xmlThis implicitly sets
gg.log=logbackand appendslogback-classicandlogback-coreto the classpath.
These are implicit settings of
gg.logandgg.log.classpaththat will be overridden by an explicit setting of either of these properties in the property file. The logging classpath will also be overridden by setting the JVM classpath to include specific JARs, such as:jvm.bootoptions=...-Djava.class.path=
mypath/my1.jar:mypath2/my2.jar...Note:
Setting the JVM classpath to include specific JARs may cause duplicate, possibly conflicting, implementations in the classpath.
-