在上,Spring Data R2DBC 我可以通过使用Kingk查询记录。
logging.level.org.springframework.data.r2dbc=DEBUG
http://www.ohchr.org。
然而,这并没有将实际价值作为定点参数。
我怎么能够将春季数据R2DBC中的查询参数的实际价值记录下来?
在上,Spring Data R2DBC 我可以通过使用Kingk查询记录。
logging.level.org.springframework.data.r2dbc=DEBUG
http://www.ohchr.org。
然而,这并没有将实际价值作为定点参数。
我怎么能够将春季数据R2DBC中的查询参数的实际价值记录下来?
对头2,也许其他行将尝试:
logging.level.io.r2dbc.h2=TRACE
在PopBoot诉2.7.5案中,
logging.level.org.springframework.r2dbc=TRACE
logging.level.org.springframework.r2dbc=DEBUG
如果你会使用MySQL,那么通过将驾驶员的标识水平设定为<代码>,你可以把与数据库服务器的所有通信放在低水平的网络上。 TRACE。
logging.level.ROOT=TRACE
logging.level.dev.miku.r2dbc.mysql.client.ReactorNettyClient=TRACE
例产出:
19-11-2020 00:03:28.072 TRACE [reactor-tcp-nio-2] d.m.r.mysql.client.ReactorNettyClient - [id: 0x9cf29125, L:/127.0.0.1:63807 - R:localhost/127.0.0.1:33306] READ: 71B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 01 00 00 01 01 1b 00 00 02 03 64 65 66 00 00 00 |..........def...|
|00000010| 05 4e 4f 57 28 29 00 0c 3f 00 13 00 00 00 0c 81 |.NOW()..?.......|
|00000020| 00 00 00 00 14 00 00 03 13 32 30 32 30 2d 31 31 |.........2020-11|
|00000030| 2d 31 39 20 30 31 3a 30 33 3a 32 38 07 00 00 04 |-19 01:03:28....|
|00000040| fe 00 00 02 00 00 00 |....... |
+--------+-------------------------------------------------+----------------+
i have to update source code to log parameterize sql statement in mysql r2dbc . this is my approach :
Index: src/main/java/dev/miku/r2dbc/mysql/message/client/TextQueryMessage.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/dev/miku/r2dbc/mysql/message/client/TextQueryMessage.java b/src/main/java/dev/miku/r2dbc/mysql/message/client/TextQueryMessage.java
--- a/src/main/java/dev/miku/r2dbc/mysql/message/client/TextQueryMessage.java (revision bdba9eebe79976aa4bb75aa0aad25c7cbbdf4dec)
+++ b/src/main/java/dev/miku/r2dbc/mysql/message/client/TextQueryMessage.java (revision 1b5e0133cc8d43bfc32133912d9e3589374ae75a)
@@ -20,6 +20,8 @@
import dev.miku.r2dbc.mysql.Parameter;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
import java.nio.charset.Charset;
@@ -42,6 +44,8 @@
private final Consumer<String> sqlProceed;
+ private static final Logger logger = LoggerFactory.getLogger(TextQueryMessage.class);
+
public TextQueryMessage(List<String> sqlParts, Parameter[] values, Consumer<String> sqlProceed) {
requireNonNull(sqlParts, "sql parts must not be null");
requireNonNull(values, "values must not be null");
@@ -64,6 +68,10 @@
try {
Charset charset = context.getClientCollation().getCharset();
return ParamWriter.publish(sqlParts, values).map(sql -> {
+
+ if(logger.isDebugEnabled()){
+ logger.debug("parametered sql statement[{}]",sql);
+ }
sqlProceed.accept(sql);
ByteBuf buf = allocator.buffer(sql.length(), Integer.MAX_VALUE);
从而改变沉淀物中的原样质量:
<logger name="dev.miku.r2dbc.mysql.message.client.TextQueryMessage" level="DEBUG" additivity="false">
<appender-ref ref="async_file"/>
</logger>
http://github.com/r2dbc/r2dbc-proxy”rel=“nofollow noreferer”>r2dbc-proxy。 项目r2dbc 恳求提供你所需要的准确信息。
您可参阅,该文章涉及如何没收代理人。
基本上,你需要提供<代码>ConnectionFactory bean,并附有代理。
import io.r2dbc.proxy.ProxyConnectionFactory;
import io.r2dbc.proxy.support.QueryExecutionInfoFormatter;
import io.r2dbc.spi.ConnectionFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
class ConnectionConfig {
@Bean
ConnectionFactory connectionFactory() {
ConnectionFactory original = ...
QueryExecutionInfoFormatter formatter = QueryExecutionInfoFormatter.showAll();
return ProxyConnectionFactory.builder(original)
.onAfterQuery(queryInfo -> log.info(formatter.format(queryInfo)))
.build();
}
}
伐木产出也一样:
Thread:http-nio-8080-exec-3(38) Connection:3 Transaction:{Create:1 Rollback:0 Commit:0}
Success:True Time:5 Type:Statement BatchSize:0 BindingsSize:1
Query:["INSERT INTO test VALUES ($1)"] Bindings:[($1=100)]
is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @...
My current build lead has a great idea in theory - construct a custom Log4J appender that takes in Spring-managed beans and uses them to log errors to various other sources than just the standard log ...
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...
I have following in my applicaionContext.xml <bean id="IbatisDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="...
I am trying to write a portlet for Liferay (using Tomcat and Spring) and need to use a database via Persistence API/Hibernate. I am using some configuration XMLs (applicationContext.xml, etc.) and ...
Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...
I ve try to implement integration tests for a working application (spring, hibernate, soap, cxf). I build an SOAP-XML by hand and handle it to my endpoint. Like this: private Source createRequest(...