RE: How to debug MozLDAP code?

"Xu, Qiang (FXSGSC)" <[email protected]> Wed, 5 Aug 2009 17:05:24 +0800
Newsgroups gmane.comp.mozilla.devel.directory
Message-ID <D8C9BC7FFCF8154FB7141EB8DB609C172E71B7B2E2@SGPAPHQ-EXSCC01.dc01.fujixerox.net>
> -----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