Debugging SDK Operations
The UnboundID LDAP SDK for Java includes basic debugging support which is based on
the Java logging framework in the java.util.logging package.
Debugging is performed in the following general categories (represented by the
DebugType enumeration:
- ASN1 -- Reading and writing ASN.1 elements.
- CODING_ERROR -- Issues with usage of the LDAP SDK (e.g., providing a null argument where a non-null argument is required).
- CONNECT -- Establishing and terminating network connections.
- CONNECTION_POOL -- Operations involving connection pool usage and maintenance.
- EXCEPTION -- Exceptions that are caught during processing.
- LDAP -- Reading and writing LDAP messages.
- LDIF -- Reading and writing LDIF entries and change records.
- MONITOR -- Parsing server monitor entries.
- OTHER -- Debug messages that don't fit into any other category.
The primary interface for accessing debug information is the
com.unboundid.util.Debug class. Many of the methods in this class are
intended for use by the SDK to generate debugging information, but the following
methods are of use to developers wishing to access debug information:
-
debugEnabled() -- Indicates whether any form of debugging is enabled.
-
debugEnabled(DebugType debugType) -- Indicates whether debugging is
enabled for messages of the specified type.
-
getDebugTypes() -- Retrieves the set of debug types that are currently
enabled.
-
getLogger() -- Retrieves the Java Logger object that will be
used to write debug messages.
-
initialize() -- Resets the debugging system to use the default settings.
-
initialize(Properties properties) Resets the debugging system to use
default settings that may be overridden with the provided set of properties.
-
setEnabled(boolean enabled) -- Specifies whether the debugging system
should be enabled. If it is to be enabled, then it will be enabled for all debug
types.
-
setEnabled(boolean enabled, Set<DebugType>) -- Specifies whether
the debugging system should be enabled. If it is to be enabled, then it will be
enabled for the specified set of debug types.
Enabling Debugging via System Properties
It is also possible to enable SDK debugging by setting system properties that will
take effect when the JVM is started. The following properties may be set:
-
com.unboundid.ldap.sdk.debug.enabled -- Used to specify whether
debugging should be initially enabled. If it is provided, then the value for
this property should be "true" if debugging should be enabled by default, or
"false" if it should be disabled by default.
-
com.unboundid.ldap.sdk.debug.level -- Used to specify the initial level
for the debug logger. If it is provided, then the value should be one of the
following strings: "ALL", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE",
"FINER", "FINEST", or "OFF".
-
com.unboundid.ldap.sdk.debug.type -- Used to specify the set of debug
types for which debugging should be enabled. If it is set, then the value should
be a comma-delimited list of the desired debug types (which are the names of the
DebugType values).