티스토리 뷰
context-datasource.xml 다중 DB 사용 시 (오라클, PostgreSQL) PostgreSQL 로그만 가독성 있게 보고 싶을 경우
<bean id="dataSource-oracle" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName1}"/>
<property name="url" value="${Globals.Url1}" />
<property name="username" value="${Globals.UserName1}"/>
<property name="password" value="${Globals.Password1}"/>
</bean>
<bean id="dataSource-postgresql-spied" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${Globals.DriverClassName2}"/>
<property name="url" value="${Globals.Url2}" />
<property name="username" value="${Globals.UserName2}"/>
<property name="password" value="${Globals.Password2}"/>
</bean>
<bean id="dataSource-postgresql" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
<constructor-arg ref="dataSource-postgresql-spied" />
<property name="logFormatter">
<bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter">
<property name="loggingType" value="MULTI_LINE" />
</bean>
</property>
</bean>
pom.xml에 필요한 dependency 추가
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>0.2.7</version>
</dependency>
'IT > Java' 카테고리의 다른 글
Spring 구동 시 v$session 정보 변경법 (0) | 2014.07.25 |
---|---|
Controller 에서 request parameter Map으로 받을려면 (0) | 2014.07.23 |
Quartz scheduler CronExpression (0) | 2014.07.23 |
한글 형태소 분석 (0) | 2014.07.21 |
FastDateFormat 쓰자 (0) | 2014.07.21 |