Wednesday, April 12, 2017

AEM Logs in detail - Part 1


Hello Everyone,

  Troubleshooting is the most important part of AEM. So to help in troubleshooting, AEM provides out of the box log files for different purposes:

  1. Request.log
  2. Access.log
  3. Stdout.log
  4. Stderr.log
  5. Audit.log
  6. History.log
  7. Error.log
  8. 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)
request.PNG
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.

accesslog.jpg
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.


stdout.PNG
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).

stderr.PNG
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.

audit.png
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.


If you have any query or suggestion then kindly comment or mail us at sgaem.blog02@gmail.com.

Hope it will help you guys !!👍
Thanks and Happy Learning 😊

9 comments:

  1. Nice explanation... Hats of to both of u

    ReplyDelete
  2. Hi Guys
    I was trying to get logs in the audit logs by adding and deleting pages from the siteadmin. However there were no entries in the audit.log . Am I missing anything? I have configured the audit log to DEBUG level as written in the article. Thanks.

    ReplyDelete
  3. Brilliant explanation!! This helps so much in understanding log files. And this area is mostly ignored anywhere.

    ReplyDelete
  4. A key piece of the time, blogs are set up to get money. Blog site

    ReplyDelete