AEM Java Logging
AEM as a Cloud Service’s provides access to Java log statements. Developers of applications for AEM should follow general Java logging best practices, logging pertinent statements about the execution of custom code, at the following log levels:
While Java logging supports several other levels of logging granularity, AEM as a Cloud Service recommends using the three levels described above.
AEM Log levels are set per environment type via OSGi configuration, which in turn are committed to Git, and deployed via Cloud Manager to AEM as a Cloud Service. Because of this, it is best to keep log statements consistent and well known for environment types to ensure the logs available via AEM as Cloud Service are available at the optimal log level without requiring redeployment of application with the updated log level configuration.
Example Log Output
Log Format
Configuration Loggers
AEM Java logs are defined as OSGi configuration, and thus target specific AEM as a Cloud Service environments using run mode folders.
Configure java logging for custom Java packages via OSGi configurations for the Sling LogManager factory. There are three supported configuration properties:
| OSGi Configuration property | Description |
|---|---|
org.apache.sling.commons.log.names | The Java packages for which to collect log statements. |
org.apache.sling.commons.log.level | The log level at which to log the Java packages, specified by org.apache.sling.commons.log.names |
Changing other LogManager OSGi configuration properties may result in availability issues in AEM as a Cloud Service.
As noted in a previous section, to ensure effective monitoring of customer environments:
- The log level of AEM’s default log configuration (Apache Sling Logging Configuration) must not be modified from its default value of “INFO”.
- It is acceptable to set the log levels to DEBUG for individual packages of product code (using instances of the “Apache Sling Logging Logger configuration” OSGi configuration factory), but use it sparingly to prevent performance degradation and restore back to INFO when it is no longer needed.
- It is acceptable to adjust log levels for customer-developed code.
- All logs – for both AEM product code and customer-developed code – must maintain the default logging format.
- Log output must remain directed to the default file “logs/error.log”.
To that end, changes must not be made to the following OSGi properties:
-
Apache Sling Log Configuration (PID:
org.apache.sling.commons.log.LogManager) — all properties -
Apache Sling Logging Logger Configuration (Factory PID:
org.apache.sling.commons.log.LogManager.factory.config):org.apache.sling.commons.log.fileorg.apache.sling.commons.log.pattern
The following are examples of the recommended logging configurations (using the placeholder Java package of com.example) for the three AEM as a Cloud Service environment types.
Development
/apps/my-app/config/org.apache.sling.commons.log.LogManager.factory.config-example.cfg.json
Stage
/apps/my-app/config.stage/org.apache.sling.commons.log.LogManager.factory.config-example.cfg.json
Production
/apps/my-app/config.prod/org.apache.sling.commons.log.LogManager.factory.config-example.cfg.json
AEM HTTP Request Logging
AEM as a Cloud Service’s HTTP request logging provides insight into the HTTP requests made to AEM and their HTTP responses in time order. This log is helpful to understand the HTTP Requests made to AEM and the order they are processed and responded to.
The key to understanding this log is mapping the HTTP request and response pairs by their IDs, denoted by the numeric value in the brackets. Often requests and their corresponding responses have other HTTP requests and responses interjected between them in the log.
Example Log
Log Format
Configuring the Log
The AEM HTTP Request log is not configurable in AEM as a Cloud Service.
AEM HTTP Access Logging
AEM as Cloud Service HTTP access logging shows HTTP requests in time order. Each log entry represents the HTTP Request that accesses AEM.
This log is helpful to quickly understand what HTTP requests are being made to AEM, if they succeed by looking at the accompanying HTTP response status code, and how long the HTTP request took to complete. This log can also be helpful to debug a specific user’s activity by filtering log entries by Users.
Example Log Output
| AEM as a Cloud Service Node ID | cm-p1235-e2644-aem-author-59555cb5b8-8kgr2 |
|---|---|
| IP address of the Client | - |
| User | myuser@adobe.com |
| Date and time | 30/Apr/2020:17:37:14 +0000 |
| HTTP method | GET |
| URL | /libs/granite/ui/references/clientlibs/references.lc-5188e85840c529149e6cd29d94e74ad5-lc.min.css |
| Protocol | HTTP/1.1 |
| HTTP response status | 200 |
| Size of the response body in bytes | 1141 |
| Referrer | "https://author-p1234-e4444.adobeaemcloud.com/mnt/overlay/dam/gui/content/assets/metadataeditor.external.html?item=/content/dam/wknd/en/adventures/surf-camp-in-costa-rica/adobestock_266405335.jpeg&_charset_=utf8" |
| User agent | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36" |
Configuring the HTTP Access Log
The HTTP Access log is not configurable in AEM as a Cloud Service.
Apache Web Server and Dispatcher Logging
AEM as a Cloud Service provides three logs for the Apache Web Servers and dispatcher layer on the Publish:
- Apache HTTPD Web Server Access log
- Apache HTTPD Web Server Error log
- Dispatcher log
These logs are only available for the Publish tier.
This set of logs provides insights into HTTP requests to the AEM as a Cloud Service Publish tier prior to those requests reaching the AEM application. This is important to understand as, ideally, most HTTP requests to the Publish tier servers are served by content that is cached by the Apache HTTPD Web Server and AEM Dispatcher, and never reach the AEM application itself. Thus there are no log statements for these requests in AEM’s Java, Request or Access logs.
Apache HTTPD Web Server Access Log
The Apache HTTP Web Server access log provides statements for each HTTP request that reaches the Publish tier’s Web server/Dispatcher. Requests that are served from an upstream CDN are not reflected in these logs.
See information about the error log format in the official apache documentation.
Example Log Output
Log Format
Configuring the Apache HTTPD Web Server Access Log
This log is not configurable in AEM as a Cloud Service.
Apache HTTPD Web Server Error Log
The Apache HTTP Web Server error log provides statements for each error in the Publish tier’s Web server/Dispatcher.
See information about the error log format in the official apache documentation.
Example Log Output
Log Format
Configuring the Apache HTTPD Web Server Error Log
The mod_rewrite log levels are defined by the variable REWRITE_LOG_LEVEL in the file conf.d/variables/global.var.
It can be set to error, warn, info, debug and trace1 - trace8, with a default value of warn. To debug your RewriteRules, it is recommended to raise the log level to trace2. It’s recommended to debug rewrite rules using the Dispatcher SDK. The maximal log level for AEM as a Cloud Service is debug. Thus it is currently not effectively possible to debug rewrite rules in the cloud.
See the mod_rewrite module documentation for more information.
To set the log level per environment, use the appropriate conditional branch in the global.var file, as described below:
Dispatcher Log
Example
Log Format
Configuring the Dispatcher Error Log
The dispatcher log levels is defined by the variable DISP_LOG_LEVEL in the file conf.d/variables/global.var.
It can be set to error, warn, info, debug and trace1, with a default value of warn.
While Dispatcher logging supports several other levels of logging granularity, the AEM as a Cloud Service recommends using the levels described below.
To set the log level per environment, use the appropriate conditional branch in the global.var file, as described below:
CDN Log
AEM as a Cloud Service provides access to CDN logs, which are useful for use cases including cache hit ratio optimization. The CDN log format cannot be customized and there is no concept of setting it to different modes such as info, warn, or error.
If forwarding CDN logs to a destination that restricts inbound connections by source IP, see CDN egress IP addresses for important limitations.
Example
Log Format
The CDN logs are distinct from the other logs in that it adheres to a json format.
| Field Name | Description |
|---|---|
| timestamp | The time the request started, after TLS termination |
| ttfb | Abbreviation for Time To First Byte. The time interval between the request started up to the point before the response body started being streamed. |
| cli_ip | The client IP address. |
| cli_country | Two-letter ISO 3166-1 alpha-2 country code for the client country. |
| rid | The value of the request header used to uniquely identify the request. |
| req_ua | The user agent responsible for making a given HTTP request. |
| host | The authority that the request is intended for. |
| url | The full path, including query parameters. |
| method | HTTP method sent by the client, such as “GET” or “POST”. |
| res_ctype | The Content-Type used to indicate the original media type of the resource. |
| cache | State of the cache. Possible values are HIT, MISS, or PASS |
| status | The HTTP status code as an integer value. |
| res_age | The amount of time (in seconds) a response has been cached (in all nodes). |
| pop | Datacenter of the CDN cache server. |
| rules | The names of any matching traffic filter rules and WAF flags, also indicating if the match resulted in a block. Empty if no rules matched. |
The CDN logs can be extended with your own properties using request/response transformations.
For the format of CDN log entries sent to a logging destination, see CDN log entries by logging destination.
How to Access Logs
Cloud Environments
AEM as a Cloud Service logs for cloud services can be accessed either by downloading through the Cloud Manager interface or by tailing logs at the command line using the using the Adobe I/O command line interface. For more information, see the Cloud Manager logging documentation.
Logs for Additional Publish Regions
If additional publish regions are enabled for a particular environment, logs for each region will be available to download from Cloud Manager, as mentioned above.
The AEM logs and the dispatcher logs for the additional publish regions will specify the region in the first 3 letters after the environment id, as exemplified by nld2 in the sample below, which refers to an additional AEM publish instance located in the Netherlands:
Local SDK
AEM as a Cloud Service SDK provides logs files to support local development.
AEM logs are located in the folder crx-quickstart/logs, where the following logs can be viewed:
- AEM Java log:
error.log - AEM HTTP Request log:
request.log - AEM HTTP Access log:
access.log
Apache layer logs, including dispatcher, are in the Docker container which holds the Dispatcher. See the Dispatcher documentation for information on how to start the Dispatcher.
To retrieve the logs:
-
At the command line, type
docker psto list your containers -
To log into the container, type “
docker exec -it <container> /bin/sh”, where<container>is the dispatcher container id from the previous step -
Navigate to the cache root under
/mnt/var/www/html -
The logs are under
/etc/httpd/logs -
Inspect the logs: they can be accessed under the folder XYZ, where the following logs can be viewed:
- Apache HTTPD Web server access log -
httpd_access.log - Apache HTTPD Web server error logs -
httpd_error.log - Dispatcher logs -
dispatcher.log
- Apache HTTPD Web server access log -
Logs are also directly printed to the terminal output. Most of the time, these logs should be DEBUG, which can be accomplished by passing in the Debug level as a parameter when running Docker. For example:
DISP_LOG_LEVEL=Debug ./bin/docker_run.sh out docker.for.mac.localhost:4503 8080
Debugging Production and Stage
In exceptional circumstances, log levels need to be changed to log at a finer granularity in Stage or Production environments.
While this is possible, it requires changes to the log levels in the configuration files in Git from Warn and Error to Debug, and performing a deployment to AEM as a Cloud Service to register these configuration changes with the environments.
Depending on the traffic and the amount of log statement written by Debug, this may result in an adverse performance impact on the environment, therefore, it’s recommended that changes to Stage and Production debug levels are:
- Done judiciously, and only when absolutely necessary
- Reverted to the appropriate levels and re-deployed as soon as possible
Log Forwarding
While logs can be downloaded from Cloud Manager, some organizations find it benficial to forward those logs to a preferred logging destination. AEM supports streaming logs to the following destinations:
- Amazon S3
- Azure Blob Storage
- Datadog
- Dynatrace
- Elasticsearch (and OpenSearch)
- HTTPS
- New Relic
- Splunk
- Sumo Logic
Refer to the Log Forwarding article for details on how to configure this feature.
CDN log entries by logging destination
When CDN logs are forwarded with Log Forwarding, each entry contains the fields described in CDN Log, plus the aem_env_id, aem_env_type, aem_program_id, and aem_tier properties described under Log Entry Formats. Depending on the logging destination, the following properties also differ:
| Logging destination | timestamp | Additional properties |
|---|---|---|
| Amazon S3 (beta) | ISO 8601 string, for example "2026-03-04T10:00:01+0000" | None. Entries are identical to Azure Blob Storage. |
| Azure Blob Storage | ISO 8601 string | None |
| Datadog | ISO 8601 string | ddsource set to aemcdn, and the Datadog service and ddtags |
| Dynatrace (beta) | ISO 8601 string | source set to aemcdn |
| Elasticsearch and OpenSearch | ISO 8601 string | None |
| HTTPS | ISO 8601 string | sourcetype set to aemcdn |
| New Relic (beta) | Number: milliseconds since the Unix epoch, for example 1685092801123 | source set to aemcdn |
| Splunk | ISO 8601 string, inside the Splunk event | Sent as a Splunk HTTP Event Collector event: sourcetype (aemcdn by default), source set to fastly, and index, with the CDN log properties inside event |
| Sumo Logic | ISO 8601 string | sourcetype set to aemcdn |
For Dynatrace specifics, see Finding CDN logs in Dynatrace (beta). For the Amazon S3 file layout, see Amazon S3 CDN logs (beta).
Example of a forwarded CDN log entry, as written to Amazon S3 or Azure Blob Storage:
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an event