5.3 - Logs

5.3.1 Logs overview

ApacheDS internally uses SLF4J as a facade for logs and Log4J is bundled in the standalone ApacheDS distributions.

Logs can be configured by modifying the log4j.properties file which can be found in the conf directory of the server instance (see the previous chapter “5.1 - Layout").

Here is the Log4J configuration that comes with ApacheDS:

#############################################################################
#    Licensed to the Apache Software Foundation (ASF) under one or more
#    contributor license agreements.  See the NOTICE file distributed with
#    this work for additional information regarding copyright ownership.
#    The ASF licenses this file to You under the Apache License, Version 2.0
#    (the "License"); you may not use this file except in compliance with
#    the License.  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#############################################################################
log4j.rootCategory=WARN, F

log4j.appender.F=org.apache.log4j.RollingFileAppender
log4j.appender.F.File=${apacheds.log.dir}/apacheds.log
log4j.appender.F.MaxFileSize=100MB
log4j.appender.F.MaxBackupIndex=3
log4j.appender.F.layout=org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n

# Specific loggers (useful for debugging)
#log4j.logger.jdbm.recman.BaseRecordManager=DEBUG
#log4j.logger.org.apache.directory.server.OPERATION_LOG=DEBUG
#log4j.logger.org.apache.directory.server.OPERATION_TIME=DEBUG
#log4j.logger.org.apache.directory.api.CODEC_LOG=DEBUG
#log4j.logger.org.apache.directory.server.ACI_LOG=DEBUG
#log4j.logger.org.apache.directory.server.PROVIDER_LOG=DEBUG
#log4j.logger.org.apache.directory.server.CONSUMER_LOG=DEBUG
#log4j.logger.org.apache.directory.CURSOR_LOG=DEBUG
#log4j.logger.org.apache.directory.api=DEBUG
#log4j.logger.org.apache.directory.server=DEBUG
#log4j.logger.net.sf.ehcache=DEBUG
#log4j.logger.org.apache.mina=DEBUG

5.3.2 Default log level

By default, ApacheDS ships with a default log level set to WARN as indicated in the first line of the log4j.properties file:

log4j.rootCategory=WARN, F

This value can be modified to any of the seven log levels supported by Log4J:

Level Description
OFF Highest possible rank and is intended to turn off logging.
FATAL Very severe error events that will presumably lead the application to abort.
ERROR Error events that might still allow the application to continue running.
WARN Potentially harmful situations.
INFO Informational messages that highlight the progress of the application at coarse-grained level.
DEBUG Fine-grained informational events that are most useful to debug an application.
TRACE Finer-grained informational events than the DEBUG.

Please refer to the Log4J Manual for more details.

5.3.2 ApacheDS specific loggers

Bundled at the end of the log4j.properties file, are a set of specific loggers dedicated to a particular kind of events:

# Specific loggers (useful for debugging)
#log4j.logger.jdbm.recman.BaseRecordManager=DEBUG
#log4j.logger.org.apache.directory.server.OPERATION_LOG=DEBUG
#log4j.logger.org.apache.directory.server.OPERATION_TIME=DEBUG
#log4j.logger.org.apache.directory.api.CODEC_LOG=DEBUG
#log4j.logger.org.apache.directory.server.ACI_LOG=DEBUG
#log4j.logger.org.apache.directory.server.PROVIDER_LOG=DEBUG
#log4j.logger.org.apache.directory.server.CONSUMER_LOG=DEBUG
#log4j.logger.org.apache.directory.CURSOR_LOG=DEBUG
#log4j.logger.org.apache.directory.api=DEBUG
#log4j.logger.org.apache.directory.server=DEBUG
#log4j.logger.net.sf.ehcache=DEBUG
#log4j.logger.org.apache.mina=DEBUG

The table below summarizes what each specific logger does:

Logger Description
jdbm.recman.BaseRecordManager Logs all information related to the JDBM database used to store the entries.
org.apache.directory.server.OPERATION_LOG Logs all executed operations (search, add, delete, etc.).
org.apache.directory.server.OPERATION_TIME Logs the time each operation takes to execute.
org.apache.directory.api.CODEC_LOG Logs all incoming and outgoing LDAP Protocol requests/responses.
org.apache.directory.server.ACI_LOG Logs all information related to the ACI system.
org.apache.directory.server.PROVIDER_LOG Logs all information related to the Replication Provider(s).
org.apache.directory.server.CONSUMER_LOG Logs all information related to the Replication Consumer(s).
org.apache.directory.CURSOR_LOG Logs all information related to the Cursors handling the search of entries in the database.
org.apache.directory.api A general logger which logs all classes of the Apache Directory LDAP API.
org.apache.directory.server A general logger which logs all classes of ApacheDS.
net.sf.ehcache A general logger which logs all classes of the Ehcache API.
org.apache.mina A general logger which logs all classes of the Apache Mina API.

These loggers are deactivated by default to prevent them interfering with the root log level. Make sure to uncomment those you would like to activate (by removing the ‘#’ character in front of the line) and set the dedicated log level according to the kind of information you’re looking for.