AEM offers you the possibility to configure:
These are all OSGi configurations.
Logging in AEM is based on Sling principles. See Sling Logging for further information.
Apache Sling Logging Configuration is used to configure the root logger. This defines the global settings for logging in AEM:
This Knowledge Base article explains how to rotate the request.log and access.log files.
In addition to the global logging settings, AEM allows you to configure specific settings for an individual service:
This allows you to channel log messages for a single service into a separate file. This can be particularly useful during development or testing; for example, when you need an increased log level for a specific service.
AEM uses the following to write log messages to file:
These elements are linked by the following parameters for the appropriate elements:
Logger (Logging Logger)
Define the service(s) generating the messages.
Log File (Logging Logger)
Define the physical file for storing the log messages.
This is used to link a Logging Logger with a Logging Writer. The value must be identical to the same parameter in the Logging Writer configuration for the connection to be made.
Log File (Logging Writer)
Define the physical file that the log messages will be written to.
This must be identical to the same parameter in the Logging Writer configuration, or the match will not be made. If there is no match then an implicit Writer will be created with default configuration (daily log rotation).
Certain Loggers and Writers are included in a standard AEM installation.
The first is a special case as it controls both the request.log
and access.log
files:
The Logger:
Apache Sling Customizable Request Data Logger
(org.apache.sling.engine.impl.log.RequestLoggerService)
Write messages about request content to request.log
.
Links to:
Apache Sling Request Logger
(org.apache.sling.engine.impl.log.RequestLogger)
Writes the messages to either request.log
or access.log
.
These can be customized if required, though the standard configuration is suitable for most installations.
The other pairs follow the standard configuration:
The Logger:
Apache Sling Logging Logger Configuration
(org.apache.sling.commons.log.LogManager.factory.config)
Writes Information
messages to logs/error.log
.
Links to the Writer:
Apache Sling Logging Writer Configuration
(org.apache.sling.commons.log.LogManager.factory.writer)
The Logger:
Apache Sling Logging Logger Configuration
(org.apache.sling.commons.log.LogManager.factory.config.649d51b7-6425-45c9-81e6-2697a03d6be7)
Writes Warning
messages to ../logs/error.log
for the service org.apache.pdfbox
.
Does not link to a specific Writer so will create and use an implicit Writer with default configuration (daily log rotation).
You can define your own Logger / Writer pair:
Create a new instance of the Factory Configuration Apache Sling Logging Logger Configuration.
Create a new instance of the Factory Configuration Apache Sling Logging Writer Configuration.
In certain circumstances you may want to create a custom log file.