Skip to content

JDBC Client Driver Logger not being configured correctly#967

Merged
jprakash-db merged 3 commits into
mainfrom
jprakash-db/driver-logger-fix
Sep 2, 2025
Merged

JDBC Client Driver Logger not being configured correctly#967
jprakash-db merged 3 commits into
mainfrom
jprakash-db/driver-logger-fix

Conversation

@jprakash-db
Copy link
Copy Markdown
Collaborator

@jprakash-db jprakash-db commented Aug 29, 2025

Description

JDBC client driver is present in a different namespace than the general codebase and due to this when we configure loglevel we only configure the root logger in the com.databricks.jdbc chain but the Driver falls in the com.databricks.client.jdbc chain and hence was not configured properly

Issue

#965

Testing

Manual testing to view logs in file and console settings

NO_CHANGELOG=true

@jprakash-db jprakash-db requested a review from Copilot August 29, 2025 06:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a logging configuration issue where the JDBC client driver was not properly configured due to being in a different namespace (com.databricks.client.jdbc) than the main codebase (com.databricks.jdbc).

  • Added configuration for the driver logger in the com.databricks.client.jdbc namespace
  • Added environment variable support for customizing the driver package prefix
  • Moved a log message to execute after logger initialization

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
JulLogger.java Added driver-specific logger configuration with separate namespace handling and environment variable support
LoggingUtil.java Moved log message after logger initialization to ensure proper logging setup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/main/java/com/databricks/jdbc/log/JulLogger.java
Comment thread src/main/java/com/databricks/jdbc/log/JulLogger.java
// Only configure JUL logger if it's not already configured via external properties file
LOGGER.info("Setting up JUL logger");
JulLogger.initLogger(toJulLevel(level), logDir, logFileSizeMB * 1024 * 1024, logFileCount);
LOGGER.info("Setting up JUL logger");
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

for reviewer: Moved this log below because we want to log it after the setup

@samikshya-db
Copy link
Copy Markdown
Collaborator

I might need more context here : but how is this helping with LOGGER.info(getDriverSystemConfiguration().toString());?

@jprakash-db
Copy link
Copy Markdown
Collaborator Author

@samikshya-db
Currently when we configure the logLevel, logPath ,etc attributes from the JDBC Url param we configure it in the parent Logger with the name com.databricks.jdbc , so what happens is that our configuration gets auto propagated to any logger class with the name com.databricks.jdbc.*. But the issue is that our Driver class is present in the com.databricks.client.jdbc namespace and so it does not inherit the log configurations and we were not able to set Loglevel, etc

@samikshya-db
Copy link
Copy Markdown
Collaborator

Got it - @jprakash-db , now that I recall Zach from benchmarking team also had the same issue where he was able to see logs despite having a 0 logLevel. We weren't able to resolve his asks [Link]. This will hopefully resolve all of that. Thanks for making the change.

@samikshya-db
Copy link
Copy Markdown
Collaborator

Also, is the SLF4J setup ok and need no changes?

@jprakash-db
Copy link
Copy Markdown
Collaborator Author

@samikshya-db I have verified it for SLF4J using the log4J impl and it is working properly.
Though to point out when configuring JUL there will be some residual logs from SDK and apache as they use SLF4J based log4j2 impl. So when using JUL if user doesn't want the Sdk and arrow logs they will need to create a log4j2.xml file extra for them

@jprakash-db jprakash-db merged commit 5c985c8 into main Sep 2, 2025
12 of 13 checks passed
@jprakash-db jprakash-db deleted the jprakash-db/driver-logger-fix branch September 2, 2025 04:49
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.

3 participants