parent
97f003a52b
commit
3bda2bf365
@ -0,0 +1,40 @@
|
|||||||
|
package com.xit.core.config.support;
|
||||||
|
|
||||||
|
import javax.annotation.*;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.*;
|
||||||
|
|
||||||
|
import com.p6spy.engine.spy.*;
|
||||||
|
import com.p6spy.engine.spy.appender.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* description : P6Spy SQL 로그 Multiline 출력 포맷 Custom
|
||||||
|
* - sql이 있는 경우만 출력
|
||||||
|
* - prepared, url(DB), now 출력 제거
|
||||||
|
* packageName : kr.xit.core.spring.config.support
|
||||||
|
* fileName : P6SpySqlMultilineFormat
|
||||||
|
* author : julim
|
||||||
|
* date : 2023-04-28
|
||||||
|
* ======================================================================
|
||||||
|
* 변경일 변경자 변경 내용
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* 2023-04-28 julim 최초 생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
* @see com.p6spy.engine.spy.appender.MultiLineFormat
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class P6SpySqlMultilineFormat implements MessageFormattingStrategy {
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void setLogMessageFormat() {
|
||||||
|
P6SpyOptions.getActiveInstance().setLogMessageFormat(this.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatMessage(final int connectionId, final String now, final long elapsed, final String category, final String prepared, final String sql, final String url) {
|
||||||
|
return String.format("connection %d - [%s] | %d ms \n%s", connectionId, category, elapsed, sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue