Re: How to debug MozLDAP code?

Anton Bobrov <[email protected]> Wed, 19 Aug 2009 03:57:03 +0200
Newsgroups gmane.comp.mozilla.devel.directory
Organization Sun Microsystems, Inc.
Message-ID <[email protected]>
you have various debug levels here

http://mxr.mozilla.org/mozilla/source/directory/c-sdk/ldap/include/ldaplog.h#44

if it is not enough you should be looking at enabling some
sort of similar debug/tracing in libsasl and its plugins.

Xu, Qiang (FXSGSC) wrote:
>> -----Original Message-----
>> From: 
>> [email protected]
>>  
>> [mailto:[email protected]
>> illa.org] On Behalf Of Xu, Qiang (FXSGSC)
>> Sent: Wednesday, August 05, 2009 11:18 AM
>> To: [email protected]
>> Subject: How to debug MozLDAP code?
>>
>> But how to enable the debug switch? And where I should look 
>> into for the log file? What's the file's physical location?
> 
> Hi, Anton: 
> 
> From your previous discussion (http://groups.google.com/group/mozilla.dev.tech.ldap/browse_thread/thread/9678332030230810?pli=1), I got to know how to trace log info in MozLDAP:
> ==================================================================
> static int ldaptool_dbg_lvl = LDAP_DEBUG_TRACE;
> ...
>   ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, (void *)&ldaptool_dbg_lvl);
>   ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, (void *)&ldaptool_dbg_lvl);
> ...
>   ldapStatus = ldap_sasl_interactive_bind_ext_s(ldapHandle, "", sasl_mech,
>                                            	NULL, NULL, sasl_flags,
>                                            	example_sasl_interact, NULL, &responseControls);
> ==================================================================
> It works, but only to a limited degree. 
> 
> The following is the debug output: 
> ==================================================================
> ldap_init
> ldap_sasl_interactive_bind_s
> nsldapi_connect_to_host: crius.xcipv6.com, port: 389
> Starting SASL/GSSAPI authentication
> Doing step 1 of client start for SASL/GSSAPI authentication
> Doing step 2 of client start for SASL/GSSAPI authentication
> ldap_err2string
> ==================================================================
> The debug information displayed is still very limited. For example, it even didn't report what error code and the associated error string, although we know something is wrong in step 2 of client start for SASL/GSSAPI authentication (shall I look into SASL or GSSAPI plugin logs, at this point?).
> 
> I wonder if the level LDAP_DEBUG_TRACE can force out all logs of LDAP/SASL activities. I have tried another leve LDAP_DEBUG_ANY, but with this level set, there isn't anything output into the terminal.
> 
> Hope you can help me more,
> Xu Qiang