[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7689) Configuration directive 'logfile' has no use



Full_Name: Eric Urban
Version: 2.4.36
OS: RHEL 6.4
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (158.147.58.198)


Hi, I have been working on packaging 2.4.36 for RHEL 6.4. No issues there. One
requirement is to have logging enabled by default. OpenLDAP supports syslog, but
its use is discouraged within my business area. I noticed the 'logfile'
configuration directive. I still use the 'slapd.conf' configuration file format,
if that matters. I added the following line to my 'slapd.conf'

logfile /var/log/openldap/openldap.log
loglevel none sync stats

Then I did

mkdir /var/log/openldap
chown ldap:ldap /var/log/openldap

I restart OpenLDAP and the log file is created but never written to. If I start
openldap with 'slapd -d -1' the log file is written to. I checked in
include/ldap_log.h and see that the macros for LogN check against 'ldap_debug'
before calling lutil_debug. The pseudo-variable 'ldap_debug' is a  preprocessor
#define at the bottom of the same file. It is just an integer bitmask for
logging. I took a look at servers/slapd/bconfig.c and see that 'config_generic'
does an fopen() and then passes the result to lutil_debug_file. So far, so good.
In config_loglevel the 'loglevel' directive from my slapd.conf is parsed and
assigned to 'ldap_syslog' but never 'ldap_debug'. So slapd in server mode will
create this file but never write to it. If you set 'logfile' in slapd.conf and
start with the -d flag it will, but this is pretty pointless is as you already
have the logging messages in your terminal in that case.

Is this intentional? I'm not seeing the utility of the 'logfile' configuration
directive. In normal operations it's only purpose will be to create an empty
file and to confuse system administrators.