featzhang opened a new pull request, #35:
URL: https://github.com/apache/flink-connector-http/pull/35
## Purpose
This PR improves HTTP request error logging in the HTTP connector by adding
configurable error logging with detailed context. Previously, HTTP errors were
logged with minimal information, making it difficult to diagnose issues in
production environments. This enhancement provides more comprehensive error
details including HTTP status codes, response bodies (configurable), and
configurable log levels.
## Change log
- Added `HttpErrorLogLevel` enum for configurable error log levels
(ERROR/WARN/INFO)
- Added `HttpErrorLogger` class for enhanced error logging with detailed
context
- Added configuration options:
- `http.error.log.level`: Controls error log level (default: ERROR)
- `http.error.log.include.body`: Whether to include response body in logs
(default: false)
- `http.error.log.body.max.size`: Maximum body size to log in bytes
(default: 1024)
- Integrated `HttpErrorLogger` in `JavaNetHttpPollingClient` and
`JavaNetSinkHttpClient`
## Verifying
- All existing tests pass
- Added comprehensive unit tests for `HttpErrorLogger` (12 tests, all
passing)
- Code style checks pass (Checkstyle and Spotless)
- Manual testing confirmed:
- Error logging works with different log levels
- Response body inclusion is configurable
- Body size limit is enforced
- Logs include all relevant context information
## Affected Components
- `flink-connector-http-core`: Core HTTP client implementation
- Configuration system: New configuration parameters for error logging
## Documentation
Configuration documentation should be updated to include the new error
logging parameters:
- `http.error.log.level`
- `http.error.log.include.body`
- `http.error.log.body.max.size`
## Backward Compatibility
This change is fully backward compatible. All new configuration parameters
have sensible defaults, and existing code will continue to work without
modifications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]