Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note
titleWork in progress

This site is in the process of being reviewed and updated.

Wiki Markup
{scrollbar}

Configure logging

In order to detect and analyze problems, adjusting the log level of a server can be a valuable tool. This section describes how to configure logging within a standalone ApacheDS.

Table of Contents
minLevel2
maxLevel2
typelist

ApacheDS and logging

ApacheDS 1.5 uses SLF4J as its logging solution. This is a simple facade for various logging APIs. The default for ApacheDS 1.5 is log4j.

Default behavior after installation

By default, ApacheDS writes log files in the directory <APACHDS_HOME>/var/log/. Besides stdout, a RollingFileAppender is used to collect warnings and errors. It backups the log files when they reach a certain size.

...

Property name

Value in file above

Meaning

File

apacheds-rolling.log

path to the output log file, in our case relative to var/log

MaxFileSize

1024KB

maximum size that the output file is allowed to reach before being rolled over to backup files

MaxBackupIndex

5

number of backup files kept

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7a6ff076bee704b5-220715c3-4f98436f-9313aea1-59c833b563b78d4dd72e36c7"><ac:plain-text-body><![CDATA[

layout.ConversionPattern

[%d{HH:mm:ss}] %p [%c] - %m%n

format string for logging events

]]></ac:plain-text-body></ac:structured-macro>

If the default logging does not meet your requirements, you can easily adjust the configuration to your needs.

Adjusting logging to your needs

Log file location (where the log files are placed)

By default the log files are placed at <APACHDS_HOME>/var/log/, but that can be changed.

Linux/MacOS/Solaris

On this systems the location of the log files is configured via an entry in /bin/server.init. Look for the following lines and change it to your preferences:

No Format
$DAEMON_HOME/apacheds \
...
-outfile $SERVER_HOME/var/log/apacheds-stdout.log \
-errfile $SERVER_HOME/var/log/apacheds-stderr.log \
...    
$APACHEDS_HOME start

Windows

On Windows you can use the configuration wizard for the service as shown in the screenshot above. To adjust the log path you have to adjust the values of Redirect Stdout and Redirect Stderror

Log level (how detailed the logs are)

The following log levels from log4j are used for messages within ApacheDS:

...

If the global level is switched to DEBUG, these definitions override the setting with WARN for certain areas and therefore keep the file a little bit smaller. Learn more about the concept of categories in the Short introduction to log4j.

Format for log messages

The format of each line within a log file is controlled by a pattern. For the RollingFileAppender in the default configuration it looks like this

...

Warning
titleWarning

"Generating caller location information like with %M or %L is extremely slow. Its use should be avoided unless execution speed is not an issue." (from the log4j documentation)

Advanced log4j configuration

You can take advantage of other features of log4j as well, such as other appenders like the daily rolling file appender. And you can configure logging to make it easier for you to view the messages with tools like Log Factor 5 or Chainsaw.

Learn more about log4j and related tools at its homepage.

Example configurations

The following example could be used to log all incoming search, add, delete, modify and moddn requests:

Code Block
log4j.logger.org.apache.directory.server.ldap.handlers.SearchHandler=DEBUG
log4j.logger.org.apache.directory.server.ldap.handlers.AddHandler=DEBUG
log4j.logger.org.apache.directory.server.ldap.handlers.DeleteHandler=DEBUG
log4j.logger.org.apache.directory.server.ldap.handlers.ModifyHandler=DEBUG
log4j.logger.org.apache.directory.server.ldap.handlers.ModifyDnHandler=DEBUG

Log settings of the Windows daemon process

After installation on Windows, you have the option to configure the ApacheDS Windows Service (you can do this later as well). If you do so, one option pane is dedicated to logging:

...

You can adjust the logging level and a log path. Note that this is for the daemon only. The server itself is configured as described above.

Resources