Troubleshooting AEM projects - bartoszWesolowski/aem-tips GitHub Wiki

Troubleshooting AEM projects

Logging

Global Logging

Apache Sling Logging Configuration

  • PID: org.apache.sling.commons.log.LogManager
  • Log Level (DEBUG , INFO , WARN , ERROR and FATAL) and Log File , to define the location and log level of the central logging configuration (error.log).
  • Number of Log Files and Log File Threshold to define the size and version rotation of the log file.
  • Message Pattern defines the format of the log messages. global logging config

Creating custom log files

AEM allows to configure separate log file for an individual service. This allows to set logging in individual file, with specific log level, rotation options and message format. Can be helpful for debugging if a different log level is needed for given service.

To create custom log file either go to the web console and create new entries for Logger Configuration and Logger Writer Factory or create config files in your project repository that will create desired log file when the application is deployed.

Apache Sling Logging Logger Configuration (Factory Configuration)

  • Factory PID: org.apache.sling.commons.log.LogManager.factory.config
  • Log File to define the existence of a log file.
  • Number of Log Files to define the version rotation.
  • The writer can be used by a Apache Sling Logging Logger Configuration configuration.
  • helpful during development; for example, to log TRACE messages for a specific service in a specific log file.
  • helpful in a production environment; for example, to have messages about a specific service logged to an individual log file for easier monitoring.

Logger configuration

Apache Sling Logging Writer Configuration (Factory)

  • Factory PID: org.apache.sling.commons.log.LogManager.factory.writer
  • Log File to define the existence of a log file.
  • Number of Log Files to define the version rotation.
  • Allowed size of log file or rotation scheduler.

Logging Writer configuration

Accessing logs

By default all logs are available under:

  • <cq-installation-dir>/crx-quickstart/logs/
  • <cq-installation-dir>/crx-quickstart/repository/

Default log files: access.log All access requests to AEM WCM and the repository are registered here.

  • audit.log - Moderation actions are registered here.
  • error.log - Error messages (of varying levels of severity) are registered here.
  • request.log - Each access request is registered here together with the response.
  • stderr.log - Holds error messages, again of varying levels of severity, generated during startup. By default the log level is set to Warning (WARN)
  • stdout.log - Holds logging messages indicating events during startup.
  • upgrade.log - Provides a log of all upgrade operations that runs from the com.day.compat.codeupgrade and com.adobe.cq.upgradesexecutor packages.
  • s7access-<yyyy>-<mm>-<dd>.log - This log is only used if dynamic media is enabled. The s7access log records each request made to Dynamic Media through /is/image and /is/content.
  • ImageServer-<PortId>-yyyy>-<mm>-<dd>.log - This log is only used if dynamic media is enabled. It provides statistics and analytical information used for analyzing behavior of the internal ImageServer process.

Request log

  • Logs all requests and responses
  • Logs time needed to render the response
  • This list can be sorted by response time using crx-quickstart/opt/helpers/rlog.jar tool
02/Nov/2016:12:17:18 +0530 [5] -> GET /etc/clientlibs/granite/jquery.js HTTP/1.1
02/Nov/2016:12:17:18 +0530 [6] -> GET /etc/clientlibs/granite/typekit.js HTTP/1.1
02/Nov/2016:12:17:18 +0530 [6] <- 200 application/x-javascript 16ms 02/Nov/2016:12:17:18 +0530 [7] -> GET /libs/granite/core/content/login/clientlib.js HTTP/1.1
02/Nov/2016:12:17:18 +0530 [7] <- 200 application/x-javascript 15ms
02/Nov/2016:12:17:18 +0530 [4] <- 200 text/css 78ms
  • configured by org.apache.sling.engine.impl.log.RequestLogger

Web log tail

Web console allows to display tail of a log file in the borwser. To do that open web console SLing -> Log Support. Then click on desired file name in Appender section. This will open an url like: /system/console/slinglog/tailer.txt?tail=10000&grep=*&name=%2Flogs%2Ferror.log that will display desired error log.

Debbuging

To enable remote debugging AEM needs to be started with the following parameter: agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n

Either:

  • add this param to CQ_JVM_OPTS system variable and start AEM with start bat or
  • add it directly to command that starts aem
  • in case of an issue use -nofork switch

Replication

Replications getting queued up in the replication agent queues

  • check replication agents on author: /etc/replication/agents.author.html
  • in case queue show blocked status - make sure that publish instance is running correctly
  • in case queue show pending status - this might happen when dispatcher/publish takes a lot of time to prepare the response (author is waiting for it) - try to fix the problem with slow responses
  • to debug the issue custom log file might be helpful, create one for categories: com.day.cq.replication with DEBUG level

Documentation

⚠️ **GitHub.com Fallback** ⚠️