Tag Archives: log4j

log4j2 에서 특정 문자열이 존재하는 로그의 행(row)을 정규식(regex)로 출력에서 제거하기

By | 6월 30, 2021

<Appenders> <Console name="console" target="SYSTEM_OUT"> … <RegexFilter regex=".*==>\s*(Preparing|Parameters).*" onMatch="DENY" onMismatch="ACCEPT"/> …. </Console> </Appenders> 위 샘플은 org.apache.ibatis.plugin.Intercepts 를 사용하여 parameter bound query log 를 출력시, 기존에 출력해 주던 쿼리 로그가 필요 없어져서 (preparing statement, parameter 등) 해당 부분을 출력에서 제외하는 예제임. <RegexFilter /> 를 하나 더 선언해 봤는데, 처음에 선언한 것만 작동하는 느낌이었음.