AEM as a Cloud Service: Stack traces not captured as multiline entries in New Relic

This article explains how to address the issue where Java stack traces from Adobe Experience Manager (AEM) as a Cloud Service aren’t captured as multiline entries in New Relic, which can impact error analysis and troubleshooting.

Description description

Environment

Adobe Experience Manager as a Cloud Service (AEMaaCS) (all versions)

Symptoms

  • When AEM log forwarding is configured to send logs to New Relic, error events are received, but Java stack traces aren’t displayed as multiline entries.
  • Instead, only single-line error messages appear, making it difficult to perform root cause analysis.
  • Other errors may show full stack traces, indicating that the log forwarding pipeline can handle multiline logs when present in the source.

Cause

This issue typically occurs when the application code logs only the exception message, rather than the full exception object. As a result, the source log contains only a single-line message with no stack trace. Additionally, the log forwarding pipeline (using Fluent Bit) forwards logs as single-line entries, so multiline stack traces must be present in the source log and properly aggregated in New Relic for full visibility.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Update application logging:

    • Ensure your application code logs the full exception object, not just the exception message. For example, use logger.error("Error occurred", exception) instead of logger.error(exception.getMessage()) to include the stack trace in the log output.
  2. Verify source logs:

    • Check the AEM logs directly to confirm that stack traces are present for the relevant error events. If only single-line messages are present, update your logging code as described above.
  3. Review log forwarding configuration:

    • AEM as a Cloud Service uses a default logging format and forwards logs using Fluent Bit. Don’t modify the default logging pattern or file properties, as customizations are unsupported and may disrupt log forwarding.
  4. Configure multiline handling in New Relic:

    • If stack traces are present in the source logs, but appear as separate single-line entries in New Relic, configure multiline log handling in New Relic to aggregate related log lines into a single event. Refer to New Relic’s documentation for details on multiline log parsing and aggregation settings.
  5. Test with known multiline errors:

    • Identify an error in AEM that is known to produce a full Java stack trace. Check if the full trace appears in New Relic as a single aggregated entry. If not, adjust New Relic’s multiline configuration accordingly.
  6. Confirm no log format customization:

    • Ensure that no changes have been made to logging pattern or file properties in AEM configuration, as these aren’t supported and may affect log forwarding.

After making these changes, trigger an error that produces a stack trace, and confirm that it appears as a multiline entry in New Relic.

recommendation-more-help
experience-cloud-kcs-help-kbarticles