logQuery: Log format modification
This commit is contained in:
parent
cecbacfad4
commit
4b8e2efc38
@ -24,7 +24,6 @@ import org.springframework.jdbc.core.namedparam.ParsedSql;
|
|||||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -42,8 +41,8 @@ public class DefaultQueryLogComponent implements QueryLogComponent {
|
|||||||
if (logSqlQueries && duration > logQueriesThreshold) {
|
if (logSqlQueries && duration > logQueriesThreshold) {
|
||||||
|
|
||||||
String sqlToUse = substituteParametersInSqlString(query, ctx);
|
String sqlToUse = substituteParametersInSqlString(query, ctx);
|
||||||
log.warn("SLOW QUERY took {} ms: {}", sqlToUse, duration);
|
log.warn("SLOW QUERY took {} ms: {}", duration, sqlToUse);
|
||||||
Arrays.asList(ctx.getParameterNames()).forEach(param -> log.info("QUERY PARAM: {} -> {}", param, ctx.getValue(param)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,6 @@ public class DefaultQueryLogComponentTest {
|
|||||||
@Test
|
@Test
|
||||||
public void logQuery() {
|
public void logQuery() {
|
||||||
|
|
||||||
BDDMockito.willCallRealMethod().given(queryLog).logQuery(ctx, "", 3000);
|
|
||||||
BDDMockito.willReturn("").given(queryLog).substituteParametersInSqlString("", ctx);
|
BDDMockito.willReturn("").given(queryLog).substituteParametersInSqlString("", ctx);
|
||||||
queryLog.logQuery(ctx, "", 3000);
|
queryLog.logQuery(ctx, "", 3000);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user