Skip to content

replaced e.printStackTrace() with SLF4J logger in PatientExtProvider#205

Open
areychana wants to merge 1 commit intoPSMRI:mainfrom
areychana:fix/patient-ext-provider-logger
Open

replaced e.printStackTrace() with SLF4J logger in PatientExtProvider#205
areychana wants to merge 1 commit intoPSMRI:mainfrom
areychana:fix/patient-ext-provider-logger

Conversation

@areychana
Copy link
Copy Markdown

@areychana areychana commented Apr 21, 2026

📋 Description

JIRA ID:

PatientExtProvider.java has no SLF4J logger declared, so both catch blocks fall back to e.printStackTrace(). Every other class in this codebase uses LoggerFactory.getLogger(...) so this one was just missed. In production, stdout is not picked up by log aggregators so any exception thrown from these FHIR endpoints disappears silently with no trace in logs.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)

ℹ️ Additional Information

Added SLF4J imports, declared a logger field on the class, and replaced both e.printStackTrace() calls with logger.error(message, e). Logging only change, no behaviour modified. Follows the same pattern used everywhere else in the project.

Summary by CodeRabbit

  • Chores
    • Enhanced error logging for patient and visit data retrieval operations to improve system diagnostics and troubleshooting capabilities.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e679f153-c0f0-4896-8c8f-66bddc93dfcf

📥 Commits

Reviewing files that changed from the base of the PR and between 05cdfbb and 0043a92.

📒 Files selected for processing (1)
  • src/main/java/com/iemr/hwc/fhir/provider/patient/PatientExtProvider.java

📝 Walkthrough

Walkthrough

A static SLF4J logger was added to PatientExtProvider and two printStackTrace() calls in catch blocks were replaced with proper logger.error() calls. No functional behavior or control flow was altered.

Changes

Cohort / File(s) Summary
Logging Improvements
src/main/java/com/iemr/hwc/fhir/provider/patient/PatientExtProvider.java
Added SLF4J logger and replaced two printStackTrace() calls with logger.error() statements in exception handlers for findPatientsByDistrictAndLastModifDate() and findVisitsByVillageAndLastModifDate() methods.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A logger hops in, so crisp and so clean,
No more stack traces scattered between,
SLF4J logs our errors with care,
Proper debugging everywhere! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the primary change: replacing printStackTrace() calls with SLF4J logger in PatientExtProvider. It is concise, specific, and clearly conveys the main intent.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant