Skip to content

feat(bqjdbc): Per connection logs - Add PerConnectionFileHandler#12899

Open
Neenu1995 wants to merge 4 commits intomainfrom
ns/handler-per-conn-logs
Open

feat(bqjdbc): Per connection logs - Add PerConnectionFileHandler#12899
Neenu1995 wants to merge 4 commits intomainfrom
ns/handler-per-conn-logs

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented Apr 23, 2026

  • PerConnectionFileHandler.java: Introduced a logging handler mapping logs via InheritableThreadLocal constructs.
  • BigQueryJdbcMdc.java: Reduced interface exposure to strict package scopes.
  • PerConnectionFileHandlerTest.java: Introduced coverage validations verifying default execution routing.

@Neenu1995 Neenu1995 requested review from a team as code owners April 23, 2026 14:49
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements connection-specific logging via a new PerConnectionFileHandler and restricts the visibility of BigQueryJdbcMdc members. The review feedback focuses on preventing resource leaks by managing the lifecycle of internal FileHandler instances and improving robustness through null checks, exception-safe resource closure, and the use of ErrorManager for internal error reporting.

Neenu1995 and others added 2 commits April 23, 2026 12:20
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
handlers.computeIfAbsent(
connectionId,
id -> {
try {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you move it to a helper function instead of lambda? (And can be merged with setup for defaultHandler)

});
}

if (handler != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can handler be null?

}

public void closeHandler(String connectionId) {
if (connectionId != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think this check is not required. If it is null, .remove() is going to return null which is handled.

}

private String getLogFilePath(String id) {
String path = baseLogPath;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we store baseLogPath as a Path (maybe using toAbsolutePath when initialized and use `baseLogPath.resolve("BigQuery-" + id + ".log")?

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.

2 participants