Ad Code

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 😊

Wednesday, April 5, 2017

Touch UI Composite Multi-field with CheckBox Issue in AEM 6.2


Hello Everyone,

In Part-1 of Custom Multifield, we have gone through some of the issues of "Custom Multifield", but there are two more issues still persist. In this blog we will see how to handle them.

Issue 1: When we use checkbox widget in Composite Multi-Field, It doesn’t work properly.

  • In below dialog "Open in new tab" checkbox will be unchecked on re-opening the dialog box in-spite of the fact that it was checked or unchecked earlier.
checkbox.PNG
Fig- Not showing the saved value in node

  • In multifield, it doesn’t matter whether you select or deselect the values, the value of the checkbox  “_target” will always be saved in the repository.
^5FAA1604936855B9E087171B954A51B6D3128746BD378448A6^pimgpsh_fullsize_distr.jpg
Fig- Always saving the value in node even checkbox is not selected

To fix this we need to update the "Multifield.js" for the same.

Once the above js is updated you can check the "Open in new tab checkbox" and the correct values will be stored in the repository(node).
^086E03CEF65B2975A334E79817DE7AB66196F7AD841B1B4F9F^pimgpsh_fullsize_distr.jpg
Fig - Showing the correct checkbox status

^4AF3775DC7230CCAD1D2B8F2189C61DC36A8B897BAAA17155A^pimgpsh_fullsize_distr.jpg
Fig - Correct value saved in node
Issue 2: None of the property is available out of the box to restrict the size of multifield.

To solve this issue:

  • Add the limit property in node which is having sling:resourceType as "granite/ui/components/foundation/form/multified" .The value corresponds to limit attribute will denote the number of multifield items allowed. Let's say limit is set to 3 then only 3 multifield values will be allowed and for 4th value it will show an alert with the respective error message.

Capture.PNG
Fig- Add limit property to multifield node
  • Create file (nt:file) "/apps/aem-learning/components/content/multifield/clientlibs/js/limit.js" and add the following JS file
You can see the alert if you will add more items than the limit :

Capture.PNG
Fig - Multifield size limit cross
And this is how we can customised the multifield accrodingly.

Refer below package and try it yourself.
Demo Package Install


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 😊