feat: p6spy 설정 추가
parent
1ce0ee719a
commit
8fa4829c03
@ -0,0 +1,17 @@
|
|||||||
|
package cokr.xit.ens.core.config.logging;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class P6SpyConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public P6SpyEventListener p6SpyCustomEventListener() {
|
||||||
|
return new P6SpyEventListener();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public P6SpyFormatter p6SpyCustomFormatter() {
|
||||||
|
return new P6SpyFormatter();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package cokr.xit.ens.core.config.logging;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import com.p6spy.engine.common.ConnectionInformation;
|
||||||
|
import com.p6spy.engine.event.JdbcEventListener;
|
||||||
|
import com.p6spy.engine.spy.P6SpyOptions;
|
||||||
|
|
||||||
|
public class P6SpyEventListener extends JdbcEventListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAfterGetConnection(ConnectionInformation connectionInformation, SQLException e) {
|
||||||
|
P6SpyOptions.getActiveInstance().setLogMessageFormat(P6SpyFormatter.class.getName());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue