[SpringBoot][MyBatis] Logging(Show SQL Query)
2022. 6. 19. 06:45ใBack-End ์์ ์ค/Spring Framework
728x90
๋ฐ์ํ
Git Hub ์ฃผ์ : https://github.com/junyharang-Development-Lab/mybatis-paging-search-test/tree/main
๐ Mybatis Logging (Show SQL Query)
๐ฝ ์์กด์ฑ ์ค์
๐ฆ build.gradle
// SQL query show
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
์ต์ด ์์กด์ฑ ์ถ๊ฐ๋ฅผ ์ํด ์์ ๊ฐ์ด ์์กด์ฑ ๋ด์ฉ์ ๋ฑ๋กํด ์ค๋๋ค.
์ฐธ๊ณ ๋ก Log4j์ ๊ฒฝ์ฐ ์ต๊ทผ ์ทจ์ฝ์ ๋ฐ ํด์ปค์ ๊ณต๊ฒฉ ๋ฑ์ผ๋ก Issue๊ฐ ๋งค์ฐ ๋ง์์์ผ๋ก ์ ํ์ธํ์๊ณ , ์ฌ์ฉํ์๊ธธ ๊ถ๊ณ ๋๋ฆฝ๋๋ค.
๐ฝ ๊ตฌ์ฑ
๐ฆ application.yml
spring:
datasource:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mariadb://{DataBase IP ์ ๋ณด}:{DataBase Port ๋ฒํธ}/{DataBase ์ด๋ฆ}?serverTimezone=UTC&characterEncoding=UTF-8
username: {DataBase User ID}
password: {DataBase User Password}
๋ฐ์ํ
๊ทธ๋ฐ ๋ค์ application.yml์ ์์ driver-class-name๊ณผ url์ log4jdb๋ฅผ ์ถ๊ฐํ ๋ด์ฉ์ ๊ธฐ์ฌํด ์ค๋๋ค.
๐ฝ ๊ฒฐ๊ณผ
๐ฆ ์ถ๋ ฅ ๋ด์ฉ
728x90
๋ฐ์ํ
'Back-End ์์ ์ค > Spring Framework' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Spring Boot] Spring Security Basic - Spring Security ์ฃผ์ ์ํคํ์ณ ์ดํดํ๊ธฐ (0) | 2022.08.16 |
---|---|
[Spring Boot] Spring Security Basic - ๊ธฐ๋ณธ API ๋ฐ Filter ์ดํดํธ (0) | 2022.08.10 |
[Mybatis] Spring Boot์ Mybatis๋ฅผ ์ด์ฉํ Paging ์ฒ๋ฆฌ์ ๊ฒ์ ๊ธฐ๋ฅ ๊ตฌํ (0) | 2022.06.19 |
[Spring] Spring์ด๋? (0) | 2022.04.07 |
[Spring] Spring Security - Method Security (0) | 2022.03.30 |