본문 바로가기
  • 아하하
개발/Java

log4j 특정 sql 제거하기

by 쥬쥬파파 2020. 8. 5.

log4j 특정 sql 제거하기

 

<Loggers>
		<Logger name="org.apache" level="ERROR"></Logger>
		<Logger name="org.springframework" level="ERROR"></Logger>



		<Logger name="egovframework" level="ERROR"></Logger>
		<Logger name="egovframework.let" level="DEBUG"></Logger>
		<Logger name="egovframework.com.cmm" level="DEBUG"></Logger>


		<Logger name="jdbc.sqlonly" level="DEBUG">
			<RegexFilter regex="(?s).*NOT_SQL_LOG.*" onMatch="DENY" onMismatch="NEUTRAL" useRawMsg="true" />
		</Logger>
		<Logger name="jdbc.sqltiming" level="OFF"></Logger>
		<Logger name="jdbc.audit" level="OFF"></Logger>
		<Logger name="jdbc.resultset" level="OFF"></Logger>
		<Logger name="jdbc.resultsettable" level="OFF"></Logger>
		<Logger name="jdbc.connection" level="OFF"></Logger>
		<logger name="java.sql.ResultSet" level="OFF"></logger>
		<logger name="java.sql.PreparedStatement" level="OFF"></logger>
		<logger name="java.sql.Connection" level="OFF"></logger>
		<logger name="log4jdbc.debug" level="OFF"></logger>
		<logger name="org.quartz.core.QuartzSchedulerThread" level="OFF"></logger>


		<Root level="DEBUG">
			<AppenderRef ref="console" />
			<AppenderRef ref="RollingFile" />
		</Root>
	</Loggers>

 

<Logger name="jdbc.sqlonly" level="DEBUG">
<RegexFilter regex="(?s).*NOT_SQL_LOG.*" onMatch="DENY" onMismatch="NEUTRAL" useRawMsg="true" />
</Logger>

 

 

 

그리고sql mapper에 

/* NOT_SQL_LOG */

위 주석을 삽입하면 해당 sql은 출력되지 않는다. ^^