Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SukanyaByteSavy
Copy link

This PR replaces direct calls to printStackTrace() with proper SLF4J logging in RPCClientProxyHandler.kt and CryptoUtils.kt. Using a logger improves observability by ensuring stack traces are directed to the configured log appenders rather than stdout/stderr, and allows for better log level management.

Changes:

RPCClientProxyHandler.kt: Replaced rpcCallSite?.printStackTrace() with log.warn("Call site stack trace:", rpcCallSite). This ensures that call site stack traces are logged as warnings and preserved in the node logs.

CryptoUtils.kt: Added a companion object with a logger to DummySecureRandomSpi and replaced printStackTrace(System.out) with log.warn(...). This unifies the logging approach within the class.

Motivation:
Usage of printStackTrace() is generally discouraged in production code as it bypasses the logging framework, making it harder to track errors and debug issues continuously. These changes align with the codebase's standard logging practices.

Verification:

Verified that CallSite is a Throwable and will be correctly logged by SLF4J.

Ran net.corda.core.crypto.CryptoUtilsTest to ensure no regressions in crypto utilities.

Verified compilation of the client:rpc module.

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.

1 participant