How To Use Debug Logging
There are two ways to send and store loggin messages. The logging directives are specified in the global section of the slapd.conf (or cn=config for dynamic configuration).
- The loglevel directive specifies the level of debugging and the messages generated are then sent to syslog. The loglevel defaults to stats. This level should usually also be included when using other loglevels, to help analyze the logs and is recommended for all environments. The loglevels stats and sync are recommended for replicated environments. The loglevel syntax in slapd.conf is as follows:
loglevel stats sync
- The logfile directive provides the location where logs should be saved for debugging purposes. For regular slapd operation, the logfile setting does not override the logging location specified in the syslog/rsyslog configuration. It only comes into play when slapd default options are overriden in /etc/default/symas-openldap by adding SLAPD_OPTIONS="-d <loglevel>". The logfile syntax in slapd.conf is as follows.
(debugging) option selected. The syntax is as follows:
logfile /path/to/the/logfile.log
To indicate whether or not the messages should go only to the specified logfile or to stderr as well use the logfile-only directive
logfile-only on | off
To define the logfile rotation use the logfile-rotate directive
logfile-rotate <max> <Mbytes> <hours>
Available loglevels used in the configuration file or in slapd-options in /etc/defaults/symas-openldap are defined as follows:
**-1** **(any)** *Enables logging at all levels*
**0** **(none)** *No logging occurs*
**1** **(0x1)(trace)** *Trace function calls*
**2** **(0x2)(packets)** *Debug packet handling*
**4** **(0x4)(args)** *Heavy trace debugging (function args)*
**8** **(0x8)(conns)** *Connection management*
**16** **(0x10)(BER)** *Print out packets sent and received*
**32** **(0x20)(filter)** *Search filter processing*
**64** **(0x40)(config)** *Configuration file processing*
**128** **(0x80)(ACL)** *Access control list processing*
**256** **(0x100)(stats)** *Connections, LDAP operations, results (recommended)*
**512** **(0x200)(stats2)** *Stats log entries sent*
**1024** **(0x400)(shell)** *Print communication with shell backends*
**2048** **(0x800)(parse)** *Entry parsing*
**16384** **(0x4000)(sync)** *LDAPSync replication*
**3278** **(0x8000)(none)** *Only messages that get logged whatever log level is set*
The desired log level can be input as a single integer that combines the desired levels, both in decimal or in hexadecimal notation:
loglevel 16640
loglevel 0x4100
as a list of integers:
loglevel 256 16384
loglevel 0x100 0x4000
or as a list of the names that are shown between brackets:
loglevel stats sync
See Symas OpenLDAP 2.6 Logging for setting options for cn=config