After some experimentation it would seem that slapd only sends output to your configured logfile when you invoke slapd with the -d option to set your loglevel. Setting a loglevel using the configuration directive does not cause output to be sent to your logfile.

Interestingly enough if you do use the logfile directive and the file does not exist slapd will create it (even if you don't use the slapd -d option). But unless you use the -d command-line option on slapd, nothing will be written to it.
 

On Wed, Mar 30, 2011 at 4:16 PM, Mark <mah042@gmail.com> wrote:
I've been trying to get the 'logfile' configuration attribute (man5/slapd.conf.5) working but can't seem to. The relevant slapd.conf entries before I define my backend look like:

loglevel stats sync
logfile /tmp/openldap/var/log/slapd.log


and the file exists before I start slapd:

$ ls -l /tmp/openldap/var/log/slapd.log
-rw-r--r--  1 me mygrp 0 Mar 30 15:58 /tmp/openldap/var/log/slapd.log

SLAPD runs fine dumping information into syslog but my logfile stays zero length. How can I get my logfile to get written to also?

Thank you,
 

My setup:

RedHat Enerprise Linux 4.7 (Linux host 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:46:26 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux)
OpenLDAP 2.4.25
BerkeleyDB 4.8.30
OpenSSL 1.0.0d
Cyrus SASL 2.1.23

configured thusly:

(
    PATH="/tmp/openldap/bin:${PATH}"; export PATH
    echo "##BEG `date '+%Y/%m/%d %H:%M:%S'` - configure"

    CPPFLAGS="-I/tmp/openldap/include" \
    CFLAGS="-g" \
    LDFLAGS="-L/tmp/openldap/lib -R/tmp/openldap/lib" \
    ./configure \
        --without-subdir \
        --enable-slapd \
            --enable-modules \
            --enable-wrappers \
        --enable-backends=mod \
            --disable-sql \
            --disable-ndb \
        --enable-overlays=mod \
        --enable-debug \
        --prefix=/tmp/openldap
    echo "##END `date '+%Y/%m/%d %H:%M:%S'` - configure"
)

compiled and installed in /tmp/openldap

$ file /tmp/openldap/libexec/slapd
/tmp/openldap/libexec/slapd: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped