-
Notifications
You must be signed in to change notification settings - Fork 59
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
Java: Add Logger #1422
Java: Add Logger #1422
Conversation
Signed-off-by: Yury-Fridlyand <[email protected]>
Co-authored-by: Andrew Carbonetto <[email protected]>
Co-authored-by: Andrew Carbonetto <[email protected]>
Java: Add Logger
Panic handling is coming in a separate PR that overhauls how we handle errors in the FFI layer in general. |
@jonathanl-bq Ping me when it's ready |
The panic handling changes got merged already: |
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.
More logging todos were merged today, sorry.
Please see MessageHandler
and #1662
@barshaul round |
java/client/src/main/java/glide/connectors/handlers/MessageHandler.java
Outdated
Show resolved
Hide resolved
…dler.java Co-authored-by: Yury-Fridlyand <[email protected]>
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.
@Getter private static Level loggerLevel; | ||
|
||
private static void initLogger(@NonNull Level level, String fileName) { | ||
if (level == Level.DISABLED) { |
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.
DISABLED option was added to Java side for testing, since we don't want to log when we have mocks. There's other ways to do it (mocking static objects is annoying, but possible), but this is the best way.
@@ -37,6 +38,7 @@ public class ConnectionWithGlideMockTests extends RustCoreLibMockTestBase { | |||
@BeforeEach | |||
@SneakyThrows | |||
public void createTestClient() { | |||
Logger.setLoggerConfig(Logger.Level.DISABLED); |
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.
Right - this is why we need a DISABLED level logger.
Can we add a TODO to add this level to the redis-core side?
java/client/src/main/java/glide/connectors/handlers/MessageHandler.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/connectors/handlers/MessageHandler.java
Outdated
Show resolved
Hide resolved
* Implement Logger for Java client Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Yury-Fridlyand <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]>
Issue #, if available:
N/A
The Logger implementation here is based on the Python client's implementation, with some relatively small Java/JNI specific changes.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.