-
Notifications
You must be signed in to change notification settings - Fork 184
add capability to log query parameters (bindings) values #278
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
Comments
We do not record parameter values in a canonical format that is suitable for logging. When calling We could add trace logging to the bind methods so that parameters get logged at the time of their binding. |
that would be great! |
Feel free to submit a pull request. |
FYI, with r2dbc-proxy, you can do something like this: MethodExecutionInfoFormatter formatter = new MethodExecutionInfoFormatter().addConsumer((execInfo, sb) -> {
sb.append("params=");
sb.append(StringUtils.arrayToCommaDelimitedString(execInfo.getMethodArgs()));
});
ConnectionFactory proxyConnectionFactory =
ProxyConnectionFactory.builder(connectionFactory)
.listener(new LifeCycleListener() {
@Override
public void beforeBindOnStatement(MethodExecutionInfo methodExecutionInfo) {
logger.info(formatter.format(methodExecutionInfo));
}
@Override
public void beforeBindNullOnStatement(MethodExecutionInfo methodExecutionInfo) {
logger.info(formatter.format(methodExecutionInfo));
}
})
.build(); |
Feature Request
Describe the solution you'd like
I'd like to be able to specify logging level (say,
io.r2dbc.postgresql.PARAM
) which, when set to DEBUG or TRACE, would enable logging of parameters.Describe alternatives you've considered
r2bc-proxy
is an alternative, but seems to be a big overhead for such a simple use-caseTeachability, Documentation, Adoption, Migration Strategy
A mention in the README should suffice as a documentation
The text was updated successfully, but these errors were encountered: