AEM Logging

This article will talk about the types of AEM logs and how can we setup custom logger.


AEM provides out of the box log files for different purposes:

  • Request.log

  • Access.log

  • Stdout.log

  • Stderr.log

  • Audit.log

  • History.log

  • Error.log

  • Upgrade.log


Log files in detail

1. Request.log: This log file contains each request together with response related to AEM instance. By this log file we can easily monitor the performance of AEM instance.

Each request contains the following information:

  • Method (GET, POST,HEAD,PUT,DELETE)

  • Resource Path (/content/geometrixx-outdoors/en.html)

  • Protocol (HTTP/1.1 or HTTPS)

Each response contains the following information:

  • Status Code (404,200,401 etc)

  • MIME Type: (text/html, image/jpeg etc)

  • Response Time (518 ms)

Fig- Request.log

By analyzing, we can easily determine that which request and response is taking too much time. By this we can increase overall site performance.

2. Access.log: This log file is almost similar to request.log. It helps us to know the following things:

  • Who is accessing

  • Which resource is being accessed

  • At what time resource is being accessed

The requests in access.log is exactly half of request.log because the access.log defines all the request and response in just one line.

Each line in Access.log contains the following information:

  • Access IP - The IP of that system from where the request is coming.

  • Access User - The user who is sending the request.

  • Access Time - At what time resource is being accessed.

  • Request Method- The method of the request like GET, POST, PUT etc.

  • Access Resource - The resource which is accessed by user.

  • Protocol like HTTP/1.1 or HTTPS

  • Response Status Code like - 404, 200, 401 etc.

  • Content Length - It determines the length of response content.

  • Referrer URL - The referrer is the web page that sends visitors to your site using a link. In other words, it’s the web page that a person was on right before they landed on your page.

  • User Agent- It refers to a web browser telling a website information about the browser and operating system.

Fig - Access Log

3.Stdout.log: This log file basically contains the startup log. Here startup log means whenever any AEM instance created or started then it will hold the information about AEM instance like the sling.home, Apache sling etc.

Stdout.log is also useful to see the message given in java classes. This can be done by using System.out.println();

Even we can also able to see the log messages related to com.day.cq.mail.service.

Fig - Stdout log

4. Stderr.log -- This log file contains error messages of varying levels of severity. Some AEM instance related messages generated during startup Like: The JVM reports a heap size of 3618 MB, meets our expectation of 1024 MB +/- 20 . Note: By default the log level is set to Warning (WARN).

Fig- Stderr.log

5. Audit.log- This log file is used by Jackrabbit to log changes to the repository. By default this log file is set to level info. There is not much logging going on at this level because of which audit.log seems to be empty. If you set this log file to log level debug you will see log messages every time you make changes to the repository. For example if you add a component to a page, delete a page etc.

Fig - Audit.log

6.History.log: This log file contains the information about which action is performed on the content.

It contain high level logs about the actions performed by editors (actions can be edit, view, delete etc).This log is probably only relevant on author instances.

Each line contain the following information:

  • TimeStamp

  • Action

  • User

  • Content path

  • Content type(cq:page, dam:asset)

7. Upgrade.log -- Provides a log of all upgrade operations that runs from com.day.compat.code upgrade and com.adobe.cq.upgradesexecutor package. By default, this log level is set to info.

8. Error.log -- Error messages (of varying levels of severity like INFO, ERROR, DEBUG, etc.) are registered here.

Hierarchy of log4j logging levels are as follows in Highest to Lowest order

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

Note: The high level logs contains all the logs of lower levels like in case of Trace log level, it will include all the logs of debug, info, warn and error as well.


Creating Your Own Loggers and Writers


You can define your own Logger / Writer pair:

  1. Create a new instance of the Factory Configuration Apache Sling Logging Logger Configuration.

  2. Specify the Log File.

  3. Specify the Logger.

  4. Configure the other parameters as required.

  5. Create a new instance of the Factory Configuration Apache Sling Logging Writer Configuration.

  6. Specify the Log File - this must match that specified for the Logger.

  7. Configure the other parameters as required.

Create a logger by adding new logger like below:

In the url http://localhost:4502/system/console/slinglog


Logging factory config inside crx/de inside apps/<project>/config/ folder




193 views0 comments

Recent Posts

See All

More about clientlibs in AEM

Here we will talk more details about clientlibs Static Resources in clientlibs Static resources below the client library folder must be in a folder called resources. If you do not have the static reso

Debugging Clientlibs

In this article we will discuss about how we can debug the js and css file in development environment. Let's see what are the debugging tools available in AEM. To see the embedded files in clientlibs