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-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-ldap
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
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.
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
Alright. Thanks a lot.