Configuring the logging framework

You must configure the logging framework to specify how to gather the DBB debug information.

The DBB toolkit uses the Simple Logging Facade for Java (SLF4J), which provides an abstraction layer enabling you to choose the logging framework (see "Changing logging frameworks" below). By default, DBB uses the SLF4J provided Simple Logger.

Configuring the SLF4J Simple Logger

You configure the Simple Logger by providing a simplelogger.properties file in the Java™ class path. A sample file is provided in $DBB_CONF/logging/. You can edit the file there, or copy it to your own directory and edit it.

Configure simplelogger.properties to gather DBB debug information as follows. For standard log levels and other options that are built into SimpleLogger, see https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html.

  • Option 1 (Recommended): Set a logging level lower than DEBUG and set what to trace for DBB

    In the sample simplelogger.properties file, the logging level is set to WARN, which is adequate for most cases, and DBB tracing options are listed but marked as comments. To enable tracing with a non-debug logging level, for example, org.slf4j.simpleLogger.defaultLogLevel=warn, you must uncomment the corresponding lines according to your need. For example, you can enable all tracing options for DBB as follows:

    # Uncomment to enable tracing for build commands
    org.slf4j.simpleLogger.log.com.ibm.dbb.build=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.build.internal=debug
    
    # Uncomment to enable tracing for build report generation
    org.slf4j.simpleLogger.log.com.ibm.dbb.build.report=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.build.report.records=debug
    
    # Uncomment to enable tracing for dependency scanning and resolution
    org.slf4j.simpleLogger.log.com.ibm.dbb.dependency=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.dependency.internal=debug
    
    # Uncomment to enable tracing for metadata creation and storing
    org.slf4j.simpleLogger.log.com.ibm.dbb.metadata=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.metadata.cli=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.metadata.common=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.metadata.filesystem=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.metadata.jdbc=debug
    
    # Uncomment to enable tracing for zBuilder framework
    org.slf4j.simpleLogger.log.com.ibm.dbb.task.framework=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.task.configuration=debug
    org.slf4j.simpleLogger.log.com.ibm.dbb.task.framework.Orchestrator=debug
    
  • Option 2: Set the logging level to INFO

    The new zBuilder provides a "verbose" mode that provides additonal console statements in addition to its standard output. Use the org.slf4j.simpleLogger.defaultLogLevel=info option to turn this mode on.

Enabling logging with SLF4J Simple Logger

You can enable logging in one of three ways depending on where your configured simplelogger.properties file is located.

Located in $DBB_CONF/logging.

When using groovyz to execute a DBB build, pass the -Dorg.slf4j.simpleLogger argument. This adds $DBB_CONF/logging/simplelogger.properties to the Java class path. For example, enter the following command:

   $DBB_HOME/bin/groovyz -Dorg.slf4j.simpleLogger build.groovy . . . 

NOTE: The DBB CLI commands dbb (including zBuilder) automatically adds $DBB_CONF/logging/simplelogger.properties to the Java class path. No additional option is needed.

Copy simplelogger.properites to an alternate location.

Add the directory to the optional class path. For example, if the simplelogger.properties file is copied to /u/usr1/config/simplelogger.properties, enter the following command:

  • For groovyz
   $DBB_HOME/bin/groovyz -classpath /u/usr1/config/ build.groovy . . .
  • For DBB CLI commands (including the zBuilder)
   $DBB_HOME/bin/dbb -classpath /u/usr1/config/ build . . .

Located in the directory from which you launched $DBB_HOME/bin/groovyz or $DBB_HOME/bin/dbb

Both Java and Groovy consider the directory in which the Java or Groovy process is started from as the current directory, which is automatically added to the classpath. If your configured simplelogger.properties file is located in the current directory, then logging is enabled automatically and no other action needs to be taken.

Changing logging frameworks

To change the logging framework that SLF4J is configured to use, replace the DBB_HOME/lib/slf4j-simple-*.jar file with another wrapped implementation from https://www.slf4j.org of the same version as the DBB_HOME/lib/slf4j-api-*.jar file.

Logging configuration is entirely dependent on the framework chosen.