Skip to content
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

refactor(rest): improve logging in FossologyRestClient #2954

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mohamed-hanfy
Copy link

Issue:

This PR enhances logging and error handling in the FossologyRestClient to improve debugging and maintainability. It addresses inconsistent error messages and insufficient debug information when failures occur.

Changes:

  • Improved Debug Logging:

    • Added detailed debug logs before making HTTP requests (e.g., upload, scan, report generation).
    • Included relevant context such as filename, uploadId, jobId, reportId, and shaValue.
  • Enhanced Error Handling:

    • Improved exception messages for RestClientException, NumberFormatException, and unexpected cases.
    • Logs now provide clear descriptions of failures, including HTTP status codes and response bodies when available.
    • Added debug logs for detailed error stack traces.
  • Fixed Typos and Formatting Issues:

    • Corrected spelling mistakes in log messages (thannthan).
    • Standardized log message formats for consistency.

How to Test:

  1. Run the Fossology integration and attempt file uploads, scans, and reports.
  2. Trigger error scenarios (e.g., incorrect upload IDs, invalid responses, failed HTTP requests).
  3. Check logs to ensure clear and informative messages are displayed.

Suggested Reviewers:

@GMishx @EttingerK @rudra-superrr

Checklist:

  • All related issues are referenced in commit messages and in PR.
  • Logging improvements do not introduce performance overhead.
  • No new dependencies were added.

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 10, 2025
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good.

Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mohamed-hanfy , please change the commit message to follow conventional commits. You can read our docs: https://eclipse.dev/sw360/docs/development/dev-semantic-commits/

…ient

- Added detailed debug logs before HTTP requests (upload, scan, report generation).
- Included relevant context like filename, uploadId, jobId, reportId, and shaValue.
- Improved error handling with better exception messages and stack traces.
- Fixed typos in log messages and standardized formats for consistency.
- Improved null checks to prevent potential `NullPointerException`.
- Enhanced logging in error cases with specific messages and stack traces.
- Ensured proper handling of failed API responses with meaningful logs.
@Mohamed-hanfy Mohamed-hanfy changed the title Improved logging throughout FossologyRestClient for better traceability refactor(rest): improve logging in FossologyRestClient Mar 11, 2025
@Mohamed-hanfy
Copy link
Author

hello @GMishx,
I've updated the commit message to follow the semantic commit guidelines as requested. Thanks for the review!

@Mohamed-hanfy Mohamed-hanfy requested a review from GMishx March 11, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs general test This is general testing, meaning that there is no org specific issue to check for
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants