We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi @hantsy ,
Hope you are doing well, can you please create a sample to use r2dbc-proxy to log the queries.
The text was updated successfully, but these errors were encountered:
Hi @hantsy, I was able to achieve this using declaring a bean as
@Bean ConnectionFactoryOptionsBuilderCustomizer connectionFactoryOptionsBuilderCustomizer( CustomExecutionListener customExecutionListener) { return builder -> { builder.option(ConnectionFactoryOptions.DRIVER, "proxy"); builder.option(ConnectionFactoryOptions.PROTOCOL, "pool:postgresql"); builder.option(ProxyConnectionFactoryProvider.PROXY_LISTENERS, customExecutionListener); }; }
and listener as
@Component public class CustomExecutionListener implements ProxyExecutionListener { private static final Logger logger = LoggerFactory.getLogger(CustomExecutionListener.class); @Override public void afterQuery(QueryExecutionInfo queryExecutionInfo) { QueryExecutionInfoFormatter formatter = QueryExecutionInfoFormatter.showAll(); String str = formatter.format(queryExecutionInfo); logger.info("Query: {}", str); logger.info("Execution Time: {} ms", queryExecutionInfo.getExecuteDuration().toMillis()); } }
If you are fine with the approach I can raise a PR.
Sorry, something went wrong.
It is great to send a PR for this.
I think creating a new simple project is ok, and named it r2dbc-proxy.
r2dbc-proxy
Thank you.
No branches or pull requests
Hi @hantsy ,
Hope you are doing well, can you please create a sample to use r2dbc-proxy to log the queries.
The text was updated successfully, but these errors were encountered: