Conserving Resources When Using Debug and Runtime Logs
Pinned FeaturedWhen writing Vault Java SDK code, using the runtime and debug logs is essential for testing and troubleshooting issues. This post addresses how to use the logs and minimize the effect on Vault performance.
Debug logs are not enabled by default. To enable them, a debug log will need to be created, which can be done from Admin > Logs > Vault Java SDK Logs.
https://developer.veevavault.com/sdk/#debug-log
Runtime logs are on by default, and the content captured by them can be modified.
https://developer.veevavault.com/sdk/#runtime-log
In Vault Java SDK, the LogService interface provides methods to send messages to the logs.
https://developer.veevavault.com/sdk/#vault-information-service-amp-log-service
https://developer.veevavault.com/sdk/#adding-custom-runtime-log-messages
Each time a logging statement is executed, a check is done to see if the corresponding log type is enabled. As the number of logging statements increases, the number of checks also increases, which can affect Vault performance.
Logging statements can be grouped inside an if statement and checked all at once using the following methods, minimizing the number of checks that occur.
isDebugEnabled()
isWarnEnabled()
isErrorEnabled()
isInfoEnabled()
if (logService.isDebugEnabled()) { |
This practice is strongly encouraged to optimize the performance of your vault as the Java SDK code base grows larger.
Please sign in to leave a comment.
Comments
0 comments