'Spring test: can we disable hibernate logging for each method?

Suppose we have code below,

@SpringBootTest

public class TestCase {

    @Autowired ArticleRepository repo;
    
    @Test
    public void test1() {
        repo.findById(0L);
    }
    
    @Test
    public void test2() {
        repo.findById(1L);
    }
}

and in corresponding application.properties, we have logging.level.org.hibernate.SQL=debug

Is there any way to set hibernate logging level differently on each method?

Such as setting ..DEBUG for test1(), and ..TRACE for test2()?



Sources

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

Source: Stack Overflow

Solution Source