<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>0.2.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<bean id="dataSourceMaria" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
<constructor-arg ref=db설정 bean의 id>
<property name="logFormatter">
<bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter">
<property name="loggingType" value="MULTI_LINE" />
<property name="sqlPrefix" value="SQL : " />
</bean>
</property>
</bean>
오류 수정
설정하려고 파일을 여니까 갑자기 오류라며 빨간줄이 생겼다.
-> 해결 방법
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
이 부분을
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
이렇게 변경하면 된다.
추가 코드
<logger name="java.sql.Connection">
<level value="debug" />
</logger>
<logger name="java.sql.Statement">
<level value="debug" />
</logger>
<logger name="java.sql.PreparedStatement">
<level value="debug" />
</logger>
<logger name="java.sql.ResultSet">
<level value="debug" />
</logger>
<logger name="jdbc.sqlonly" additivity="false">
<level value="INFO" />
<appender-ref ref="console-infolog" />
</logger>
<logger name="jdbc.resultsettable" additivity="false">
<level value="INFO" />
<appender-ref ref="console" />
</logger>