-
Notifications
You must be signed in to change notification settings - Fork 34
Loggers added #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loggers added #81
Conversation
WalkthroughLogging statements were added in two Java classes to provide additional runtime information. In the registration service, the outgoing HTTP headers are logged before making an external API call. In the utility class, a message is logged if servlet request attributes are found to be null when preparing an HTTP entity. Changes
Poem
β¨ Finishing Touches
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. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π§Ή Nitpick comments (1)
src/main/java/com/iemr/tm/utils/RestTemplateUtil.java (1)
22-22: Prefer debug level and more descriptive log message
The addedlogger.info("Null servletRequestAttributes")at INFO may be too noisy and provides limited context. Consider lowering to DEBUG and clarifying that default headers will be used. For example:- logger.info("Null servletRequestAttributes"); + logger.debug("RequestContextHolder.getRequestAttributes() returned null; constructing HttpEntity with default JSON & Authorization headers");This avoids cluttering INFO logs and gives clearer intent.
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (2)
src/main/java/com/iemr/tm/service/registrar/RegistrarServiceImpl.java(1 hunks)src/main/java/com/iemr/tm/utils/RestTemplateUtil.java(1 hunks)
β° Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (java)
|
|
||
| RestTemplate restTemplate = new RestTemplate(); | ||
| HttpEntity<Object> request = RestTemplateUtil.createRequestEntity(comingRequest, Authorization); | ||
| logger.info("Before Calling Common-API registration : "+request.getHeaders()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Avoid logging sensitive headers and use parameterized logging
Concatenating and logging request.getHeaders() at INFO can expose credentials (e.g., Authorization or cookie tokens) and incurs unnecessary stringβbuilding overhead. Use SLF4J parameterized logs and filter or mask sensitive entries. For example:
- logger.info("Before Calling Common-API registration : "+request.getHeaders());
+ HttpHeaders safeHeaders = filterSensitiveHeaders(request.getHeaders(), List.of(HttpHeaders.AUTHORIZATION, HttpHeaders.COOKIE));
+ logger.debug("Before calling Common-API registration, headers: {}", safeHeaders);Implement filterSensitiveHeaders(...) to redact or remove sensitive keys.
Committable suggestion skipped: line range outside the PR's diff.
π€ Prompt for AI Agents
In src/main/java/com/iemr/tm/service/registrar/RegistrarServiceImpl.java at line
663, avoid concatenating and logging request headers directly as it may expose
sensitive information and cause unnecessary string building. Instead, implement
a method like filterSensitiveHeaders(...) to redact or remove sensitive headers,
then log the filtered headers using SLF4J parameterized logging syntax to
prevent string concatenation overhead and protect sensitive data.



π Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
β Type of Change
βΉοΈ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit