Logging queries executed in java driver

Im using neo4j java driver version 4.3.3. im not sure how to print the query being executed with values. Let consider the below usecase.

the query is as follows,

MATCH (p:Person {name : "John"}) RETURN p

the java code is as follows,

String query = "MATCH (p:Person {name : $name}) RETURN";
try (Session session = this.driver.session()) {
   try (Transaction tx = session.beginTransaction()) {
      tx.run (query,  parameters(name , "John"));


now printing the String variable query don't have values. i tried if i can interpolate the parameters with the string.
still not sure how to achieve that. please help me resolve this issue. because logging the queries being executed is crucial to the application.

Murali V