Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debug logs

14 views
Skip to first unread message

Bhawna

unread,
Dec 4, 2007, 5:13:13 AM12/4/07
to
Hi,

We are using Mozilla LDAP C SDK 5.12 in our application. Can anyone
please help let me know, how to enable logging facility with this
code. I do see, logging related stuff in ldaplog.h and the same being
used in some .c files in source code, but I am not able to find out
how to make it functional for my use.

Any help in this regard will be highly appreciated.

Thanks and Regards
Bhawna

Anton Bobrov

unread,
Dec 4, 2007, 5:21:11 AM12/4/07
to Bhawna, dev-te...@lists.mozilla.org

you need to set LDAP_OPT_DEBUG_LEVEL or/and LBER_OPT_DEBUG_LEVEL
depending on what exactly you are looking for, see for example :
http://lxr.mozilla.org/mozilla/source/directory/c-sdk/ldap/clients/tools/common.c#407

> _______________________________________________
> dev-tech-ldap mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-ldap

Bhawna

unread,
Dec 4, 2007, 6:43:31 AM12/4/07
to
On Dec 4, 3:21 pm, Anton Bobrov <Anton.Bob...@Sun.COM> wrote:
> you need to set LDAP_OPT_DEBUG_LEVEL or/and LBER_OPT_DEBUG_LEVEL
> depending on what exactly you are looking for, see for example :http://lxr.mozilla.org/mozilla/source/directory/c-sdk/ldap/clients/to...

>
>
>
> Bhawna wrote:
> > Hi,
>
> > We are using Mozilla LDAP C SDK 5.12 in our application. Can anyone
> > please help let me know, how to enable logging facility with this
> > code. I do see, logging related stuff in ldaplog.h and the same being
> > used in some .c files in source code, but I am not able to find out
> > how to make it functional for my use.
>
> > Any help in this regard will be highly appreciated.
>
> > Thanks and Regards
> > Bhawna
> > _______________________________________________
> > dev-tech-ldap mailing list
> > dev-tech-l...@lists.mozilla.org
> >https://lists.mozilla.org/listinfo/dev-tech-ldap- Hide quoted text -
>
> - Show quoted text -

Hi Anton,

Thank you very much for your prompt response.

I have created a simple ldap client to test the logging facility, with
one unconditional log entry. Please see below various lines of code I
am putting in, to make it functional.

#include "ldaplog.h"
#define LDAP_DEBUG
...
int ldaptool_dbg_lvl = LDAP_DEBUG_TRACE;
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL,
(void *)&ldaptool_dbg_lvl);

/* Unconditional log entry */
LDAPDebug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );

Please let me know is it all that is needed. If yes, where will this
log file be created.

Can you please suggest some link for Mozilla, where all about logging
is documented.

Thanks and Regards
Bhawna

Anton Bobrov

unread,
Dec 4, 2007, 7:00:34 AM12/4/07
to Bhawna, dev-te...@lists.mozilla.org

Bhawna wrote:
> /* Unconditional log entry */
> LDAPDebug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );

i'm not sure what this line is for in your case. all you have to
do is set relevant LDAP/LBER options as in example provided.

> Please let me know is it all that is needed. If yes, where will this
> log file be created.

flushed to where your stderr directed, redirect your stderr to
a regular file if you want it in a file.

> Can you please suggest some link for Mozilla, where all about logging
> is documented.

i dont recall it actually being described in the docs or wiki,
plz feel free to correct me or contribute to wiki otherwise.

Bhawna

unread,
Dec 4, 2007, 7:18:42 AM12/4/07
to

I am using LDAPDebug macro defined in ldaplog.h (which is in include
directory of the source code from mozilla), after including ldaplog.h
in my program. Please see below the definition for this macro in
ldaplog.h

#ifdef LDAP_DEBUG
# undef LDAPDebug

/* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */
# if defined(SLAPD_LOGGING)
# ifdef _WIN32
extern int *module_ldap_debug;
# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
{ \
if ( *module_ldap_debug & level ) { \
slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
} \
}
# else /* _WIN32 */
extern int ldap_debug;
# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
{ \
if ( ldap_debug & level ) { \
slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
} \
}
# endif /* Win32 */
# else /* no SLAPD_LOGGING */
extern void ber_err_print( char * );
extern int ldap_debug;
# define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
if ( ldap_debug & level ) { \
char msg[256]; \
sprintf( msg, fmt, arg1, arg2, arg3 ); \
ber_err_print( msg ); \
}
# endif /* SLAPD_LOGGING */
#endif /* LDAP_DEBUG */

Thanks and Regards
Bhawna

Anton Bobrov

unread,
Dec 4, 2007, 7:35:19 AM12/4/07
to Bhawna, dev-te...@lists.mozilla.org

you can use it for your own stuff if you want but to get debug
log data out of LDAP/LBER you dont need to use/call any API/
macro just set appropriate debug loggin options thats all.

Bhawna

unread,
Dec 4, 2007, 8:26:38 AM12/4/07
to
0 new messages