A. Jpa how to print sql statement?
Now most of the online approach is: add properties file: spring.jpa.show-sql = true.
Could it? Yes, however the system is printed with System.out.println method, bad management.
I would like to set up how to use the picture log 1 print it?
Logback.xml added in the <logger name = "org.hibernate.SQL" level = "DEBUG" /> it.
Two .jpa how to print parameter?
The above configuration, only print sql statement, sql parameters required in no output come out.
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="trace" />
Added to the upper logger configuration, you can print the sql parameter.
Three .jpa select statement prints super much, I do not want to see select sql statement how to do?
Appender added to the output of the line filter.
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator -->
<expression>return message.contains("select");</expression>
</evaluator>
<OnMismatch>NEUTRAL</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
Add this filter should also requires the introduction of a jar, otherwise start error.
<dependency> <groupId>org.codehaus.janino</groupId> <artifactId>janino</artifactId> <version>3.0.7</version> </dependency>