Skip to content

Logging | Removing line break in stack trace

Srishti Sharma requested to merge srsharma into master

All Submissions:


  • [YES/NO] I have added an explanation of what changes in this merge do and why we should include it? YES
  • [YES/NO] I have updated the documentation accordingly.
  • [YES/NO/NA] I have added tests to cover my changes.
  • [YES/NO/NA] All new and existing tests passed.
  • [YES/NO/NA] My code follows the code style of this project.
  • [YES/NO/NA] I ran lint checks locally prior to submission.

What is the issue or story related to the change?


Issue: Exception in stack trace is split across multiple lines causing too many logs.

Bug 6422: https://dev.azure.com/OpenEnergyPlatform/Open%20Energy%20Platform/_workitems/edit/6422

Impact: This issue is resulting in too many logs. Also impacts DRI's troubleshooting.

Target: Remove extra line or new line in exceptions so as to have more manageable logs.

log4j2.xml updated to remove new line character and add pipe separator instead. Code update: Original line 35 of log4j2.xml: <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} correlation-id=%X{correlation-id} data-partition-id=%X{data-partition-id} api-method=%X{api-method} operation-name=%X{operation-name} user-id=%X{user-id} app-id=%X{app-id}:%m%replace{%m}{[\r\n]}{|} %throwable{separator(|)}%n />

Updated line 35 of log4j2.xml:
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} correlation-id=%X{correlation-id} data-partition-id=%X{data-partition-id} api-method=%X{api-method} operation-name=%X{operation-name} user-id=%X{user-id} app-id=%X{app-id}:%m%replace{%m}{[\r\n]}{|} %throwable{separator(|)}%n />

High level design: Issue: Exception in stack trace is split across multiple lines causing too many logs. https://dev.azure.com/OpenEnergyPlatform/Open%20Energy%20Platform/_workitems/edit/6422

Test coverage:


  1. We tested the generated logs in IntelliJ Console and saw that the new lines are removed, and log size reduced.
  2. We tested on Kusto and Kusto is also not showing new lines.

Does this introduce a breaking change?


  • NO

Pending items


Reviewer request


  • Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
  • Block the MR if you feel there is less testing or no details in the MR
  • Please cover the following aspects in the MR -- Coding design: <Reviewer1> -- Backward Compatibility: <Reviewer2> -- Feature Logic: <Logic design> -- <Any other context mention here> OR -- <Component 1>: <Reviewer1> -- <CosmosDB>: <Reviewer2> -- <ServiceBus> <Reviewer3> -- <Mention any other component and owner>

Other information


Edited by Srishti Sharma

Merge request reports