Tailing logs on AEM as Cloud Service

Published
Tailing logs is a very basic need that every developer performs daily, as logs serve as the frontline for debugging AEM applications. While AEM 6.5 allows tailing logs via the System Console or SSH into AEM servers, AEM Cloud Service no longer provides this access. Instead, Adobe Cloud Manager supports accessing AEMaaCS logs via Adobe I/O CLI with Cloud Manager plugin, which allows for downloading and tailing logs. Additionally, Adobe Cloud Manager allows for the download of logs, by day, via environment's Download Logs action.
AEM Cloud Manager Download Logs
Tailing logs in AEMaaCS does not support custom log files but allows custom logging. Custom log statements must be written to the error.log. Logs written to custom files, like saml.log, are inaccessible. To write logs to error.log, use the Sling LogManager OSGi config.
org.apache.sling.commons.log.LogManager.factory.config~aem-demo.cfg.json
{ "org.apache.sling.commons.log.level": "DEBUG", "org.apache.sling.commons.log.file": "logs/error.log" }
Available log options in AEM Author and Publish services are aemerror, aemaccess, and aemrequest logs, while AEM Dispatcher provides httpdaccess, httperror, and aemdispatcher log files. The recommended log levels for custom loggers per environment type: DEBUG (Development), WARN (Stage), ERROR (Production).
Hierarchy of logging levels are as follows in Highest to Lowest order: TRACE, DEBUG, INFO, WARN, ERROR. 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. Setting a high-level log such as TRACE in a production environment can lead to excessive logging, which may impact AEM’s performance.
Here are the steps to tail logs on AEM as a Cloud Service environment:
  • Install Adobe I/O CLI: npm install -g @adobe/aio-cli
  • Install Cloud Manager Plugin: aio plugins:install @adobe/aio-cli-plugin-cloudmanager
  • Login to Adobe IMS: aio login
  • Org List: aio cloudmanager:org:list
  • Select Org: aio cloudmanager:org:select [ORGID]
  • List of Programs: aio cloudmanager:list-programs
  • Select Default Program: aio config:set cloudmanager_programid [PROGRAMID]
  • List of Environments: aio cloudmanager:list-environments
  • List Available Log Options: aio cloudmanager:environment:list-available-log-options [ENVIRONMENTID]
  • Download Logs: aio cloudmanager:environment:download-logs [ENVIRONMENTID] [SERVICE] [NAME] [DAYS]
  • Tail Log: aio cloudmanager:environment:tail-log [ENVIRONMENTID] [SERVICE] [NAME]
Write your Comment