# Logs

## Apache logging

By default, LemonLDAP::NG uses Apache logs to store user actions and other messages:

- Error log: all messages emitted by the program, depending on the configured log level
- Access log: the issuer of each request is identified

The log level can be set with Apache `LogLevel` parameter. It can be configured globally, or inside a virtual host.

See http://httpd.apache.org/docs/2.2/mod/core.html#loglevel for more information.

To configure the user identifier in access log, go in Manager, `General Parameters` > `Logging` > `REMOTE_USER`.

## Syslog

LemonLDAP::NG can also use syslog (only for user actions).

In Manager, set syslog facility in `General Parameters` > `Logging` > `Syslog facility`.

The messages are stored with the facilities :

- info for user actions
- notice for good authentications or external exchange (SAML, OpenID,…)
- warn for failed authentications

## Override logging functions

You can customize logs by redefining userNotice() and userError() methods, directly in `lemonldap-ng.ini`

Example:

    [portal]
    userError = sub { my ($self, $message) = @_; ... }
    userNotice = sub { my ($self, $message) = @_; ... }