Configuring the logging framework
You must configure the logging framework to specify how to gather the DBB debug information.
Beginning in DBB V2.0.0, 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 DBBIn the sample
simplelogger.properties
file, the logging level is set toWARN
, 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
-
Option 2: Set the logging level to
DEBUG
or higherNote that with
org.slf4j.simpleLogger.defaultLogLevel=debug
or a higher logging level, you get debug information from the entire application rather than from the designated packages. It might be overwhelming and make it difficult to spot the needed trace statements.
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
Pass the
-Dorg.slf4j.simpleLogger
argument to groovyz. This automatically adds$DBB_CONF/logging
to the end of the Java class path.For example, enter the following command:
$DBB_HOME/bin/groovyz -Dorg.slf4j.simpleLogger build.groovy . . .
-
Copied to your own directory
Add the directory to the optional
groovyz
class path.For example, if the
simplelogger.properties
file is copied to/u/usr1/config/simplelogger.properties
, enter the following command:
$DBB_HOME/bin/groovyz -classpath /u/usr1/config/ build.groovy . . .
-
Located in the directory from which you launched
$DBB_HOME/bin/groovyz
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 configuredsimplelogger.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.