How to enable logging in python-ldap

December 18th, 2007 by Leons Petrazickis

When writing Python scripts which rely on python-ldap and openLDAP, it is often useful to turn on debug messages as follows:

import ldap;

# enable python-ldap logging
ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095)

# enable openLDAP logging
l = ldap.initialize(‘ldap://yourserver:port’, trace_level=2)
 

This is also useful when debugging the LDAP Plugin for Trac.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit

Posted in python, ldap, trac |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.