'How to show sql Queries in console in springboot azure (Springboot + Azure Cosmos)

i am using SpringBoot with azurecosmos db

i want to see the query for below repository code.

findByFirstNameAndLastName(String firstName,String lastName);



Solution 1:[1]

You can try adding the below lines inside application.properties to get all the query generated in console

spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
logging.level.org.hibernate.SQL = DEBUG
logging.level.org.hibernate.type = TRACE
logging.level.org.springframework.web = DEBUG

Solution 2:[2]

For me adding following configuration to application.yaml worked.

logging:
  config: classpath:logback-local-spring.xml
  level:
    com.azure.cosmos.implementation.SqlQuerySpecLogger: debug

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Muthukumaran G
Solution 2 CyberAlexander