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.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 classpath 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 classpath 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 classpath.

    • 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 classpath.

    • 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 classpath.

    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 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.