# Replace \`e.printStackTrace()\` with \`LogEvent.logError()\`

**URL:** <https://talk.openelis-global.org/t/replace-e-printstacktrace-with-logevent-logerror/1948>\
**Category:** Uncategorized\
**Created:** [February 17, 2026, 12:26am UTC](https://talk.openelis-global.org/t/replace-e-printstacktrace-with-logevent-logerror/1948 "2026-02-17T00:26:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ketanop321](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/ketanop321/32/1139_2.png) [@ketanop321](https://talk.openelis-global.org/u/ketanop321)\
**Post date:** [February 17, 2026, 12:26am UTC](https://talk.openelis-global.org/t/replace-e-printstacktrace-with-logevent-logerror/1948/1 "2026-02-17T00:26:34Z")

</div>

**PR** #2835 **— Replace `e.printStackTrace()` with `LogEvent.logError()`**

> <https://github.com/DIGI-UW/OpenELIS-Global-2/pull/2835>
>
> Replace 11 instances of e.printStackTrace() anti-pattern with proper LogEvent.lo…gError(e) calls in 7 source files:
> 
> \- SampleTbEntryController.java: Added LogEvent import and replaced call
> \- SampleEntryByProjectController.java: Replaced 2 calls, removed 1 redundant
> \- FhirReferralServiceImpl.java: Replaced 2 calls, removed TODO comments
> \- PluginConfiguration.java: Replaced 1 call
> \- FreezerReportServiceImpl.java: Removed redundant call (LogEvent already used)
> \- FreezerAuditTrailController.java: Added LogEvent import and replaced 3 calls
> \- FreezerReportController.java: Removed redundant call (LogEvent already used)
> 
> This improves error visibility, enables log aggregation, and follows OpenELIS logging conventions. Test utilities and submodules are out of scope.
> 
> \# Pull Requests Requirements
> 
> \- \[x\] The PR title includes a brief description of the work done, including the
> Issue number if applicable.
> \- \[\] The PR includes a video showing the changes for the work done.
> \- \[x\] The PR title follows conventional commit label standards.
> \- \[x\] The changes confirm to the OpenElis Global x3
> \[Styleguide and Design\](https://uwdigi.atlassian.net/wiki/spaces/OG/pages/621346838/OpenELIS+Global+Style+Guide)
> documentation.
> \- \[x\] The changes include tests or are validated by existing tests.
> \- \[\] I have read and agree to the Contributing
> \[Guidelines\](https://openelis-global.org/community/get-involved/) of this
> project.
> 
> \## Summary
> 
> \## Screenshots
> 
> \[Add relevant screenshots here if applicable\]
> 
> \## Related Issue
> 
> \[Add a link to the related issue or mention it here if applicable\]
> 
> \## Other
> 
> \[Add any additional information or notes here\]

Small fix across 7 backend files. Replaced 11 instances of the `e.printStackTrace()` anti-pattern with the project’s standard `LogEvent.logError(e)` logging. Improves error visibility and enables proper log aggregation.

**Validation:**

- Build passes: `mvn clean install -DskipTests`
- Spotless formatting applied
- No logic changes — direct 1:1 replacement
- Self-reviewed code
- No breaking changes

@Agaba_Derrick_Junior @Moses_Mutesasira

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/openelisci/original/1X/1e5d1a910deb131d254116e7e3f97df90eb92614.png) [@system](https://talk.openelis-global.org/u/system)\
**Post date:** [February 19, 2026, 5:46am UTC](https://talk.openelis-global.org/t/replace-e-printstacktrace-with-logevent-logerror/1948/2 "2026-02-19T05:46:45Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/openelisci/original/1X/1e5d1a910deb131d254116e7e3f97df90eb92614.png) [@system](https://talk.openelis-global.org/u/system)\
**Post date:** [February 19, 2026, 4:20pm UTC](https://talk.openelis-global.org/t/replace-e-printstacktrace-with-logevent-logerror/1948/3 "2026-02-19T16:20:30Z")

</div>


