Skip to content

Commit 948ff96

Browse files
committed
add p6spy to log SQL queries
1 parent 877a183 commit 948ff96

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ src/main/resources/static/css/
3131
src/main/resources/static/favicon.ico
3232
src/main/resources/static/js/
3333
src/main/resources/templates/index.html
34+
spy.log

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2525
<java.version>1.8</java.version>
2626
<commons-io.version>2.6</commons-io.version>
27+
<p6spy.version>3.7.0</p6spy.version>
2728
</properties>
2829

2930
<dependencies>
@@ -70,6 +71,12 @@
7071
<artifactId>freemarker</artifactId>
7172
</dependency>
7273

74+
<dependency>
75+
<groupId>p6spy</groupId>
76+
<artifactId>p6spy</artifactId>
77+
<version>${p6spy.version}</version>
78+
</dependency>
79+
7380
<dependency>
7481
<groupId>org.springframework.boot</groupId>
7582
<artifactId>spring-boot-devtools</artifactId>

src/main/resources/spy.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
driverlist=com.mysql.jdbc.Driver
2+
logfile=spy.log
3+
dateformat=yyyy-MM-dd HH:mm:ss.SS
4+
logMessageFormat=com.p6spy.engine.spy.appender.CustomLineFormat
5+
customLogMessageFormat=- %(currentTime) | took %(executionTime)ms | connection %(connectionId) \nEXPLAIN %(sql);\n
6+
filter=true
7+
exclude=select 1 from dual

0 commit comments

Comments
 (0)