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.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -42,8 +41,8 @@ public class DefaultQueryLogComponent implements QueryLogComponent {
|
||||
if (logSqlQueries && duration > logQueriesThreshold) {
|
||||
|
||||
String sqlToUse = substituteParametersInSqlString(query, ctx);
|
||||
log.warn("SLOW QUERY took {} ms: {}", sqlToUse, duration);
|
||||
Arrays.asList(ctx.getParameterNames()).forEach(param -> log.info("QUERY PARAM: {} -> {}", param, ctx.getValue(param)));
|
||||
log.warn("SLOW QUERY took {} ms: {}", duration, sqlToUse);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@ public class DefaultQueryLogComponentTest {
|
||||
@Test
|
||||
public void logQuery() {
|
||||
|
||||
BDDMockito.willCallRealMethod().given(queryLog).logQuery(ctx, "", 3000);
|
||||
BDDMockito.willReturn("").given(queryLog).substituteParametersInSqlString("", ctx);
|
||||
queryLog.logQuery(ctx, "", 3000);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user