🌿코드 조각 관리 게시판
코드 조각 관리 게시판을 구현해 보도록 하자.
파일 생성
com.test.controller
- CodeController.java
com.test.persistence
- CodeDAO.java (I)
- CodeDAOImpl.java (C)
com.test.domain
- CodeDTO.java
views
- list.jsp
- views.jsp
- add.jsp
src/main/resources > mapper
- code.xml
기본 작업
1. 프로젝트 설정
2. CodeDTO 태그 name 추가
3. CodeDAOImpl과 CodeDAO implements 설정
4. CodeDAOImpl이 bean이 되도록 @Repository 붙임
@Autowired
private CodeDAO dao;
//public CodeController(CodeDAO dao) {
// this.dao = dao;
//}
5. CodeController에서 CodeDAO와 의존 주입
@Autowired
private SqlSessionTemplate template;
6. CodeDAOImpl에서 DB를 날릴 수 있도록 SqlSessionTemplate 선언
7. 요구사항 구현
🍃전체 코드
CodeController.java
package com.test.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.test.domain.CodeDTO;
import com.test.persistence.CodeDAO;
@Controller
public class CodeController {
@Autowired
private CodeDAO dao;
@GetMapping(value="/add.do")
public String add() {
return "add";
}
@PostMapping(value="/addok.do")
public String addok(CodeDTO dto) {
int result = dao.add(dto);
if (result == 1) {
return "redirect:/list.do";
} else {
return "redirect:/add.do";
}
}
@GetMapping(value="/list.do")
public String list(Model model, @RequestParam(name="language", required = false) List<String> language) {
//- list.do
//- list.do?language=java
//- list.do?language=java&language=css
System.out.println(language);
List<CodeDTO> list = dao.list(language);
model.addAttribute("list", list);
model.addAttribute("language", language);
return "list";
}
@GetMapping(value="/view.do")
public String view(Model model, String seq) {
CodeDTO dto = dao.get(seq);
model.addAttribute("dto", dto);
return "view";
}
}
CodeDAO.java (I)
package com.test.persistence;
import java.util.List;
import com.test.domain.CodeDTO;
public interface CodeDAO {
int add(CodeDTO dto);
List<CodeDTO> list(List<String> language);
CodeDTO get(String seq);
}
CodeDAOImpl.java (C)
package com.test.persistence;
import java.util.List;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.test.domain.CodeDTO;
@Repository
public class CodeDAOImpl implements CodeDAO {
@Autowired
private SqlSessionTemplate template;
@Override
public int add(CodeDTO dto) {
return template.insert("code.add", dto);
}
@Override
public List<CodeDTO> list(List<String> language) {
//[java, css, js]
return template.selectList("code.list", language);
}
@Override
public CodeDTO get(String seq) {
return template.selectOne("code.get", seq);
}
}
CodeDTO.java
package com.test.domain;
import lombok.Data;
@Data
public class CodeDTO {
private String seq;
private String subject;
private String code;
private String regdate;
private String language;
}
list.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="https://me2.do/5BvBFJ57">
<style>
#main {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.item {
border: 1px solid #AAA;
width: 240px;
margin: 5px;
cursor: pointer;
}
.item > div:nth-child(1) {
padding: .5rem;
background-color: #CCC;
}
.item > div:nth-child(2) {
min-height: 150px;
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid #AAA;
border-bottom: 1px solid #AAA;
}
.item > div:nth-child(3) {
padding: .5rem;
text-align: right;
}
#filter {
text-align: right;
padding-right: 2rem;
}
#filter input {
background-color: #FFF;
}
</style>
</head>
<body>
<!-- list.jsp -->
<h1>Code <small>list</small></h1>
<div id="filter">
<input type="button" value="Java" data-language="java" data-selected="0" data-color="cornflowerblue">
<input type="button" value="SQL" data-language="sql" data-selected="0" data-color="tomato">
<input type="button" value="HTML" data-language="html" data-selected="0" data-color="gold">
<input type="button" value="CSS" data-language="css" data-selected="0" data-color="yellowgreen">
<input type="button" value="JavaScript" data-language="javascript" data-selected="0" data-color="orange">
</div>
<div id="main">
<c:forEach items="${list}" var="dto">
<div class="item" onclick="location.href='/code/view.do?seq=${dto.seq}';">
<c:choose>
<c:when test="${dto.language == 'java'}">
<c:set var="color" value="cornflowerblue"/>
</c:when>
<c:when test="${dto.language == 'sql'}">
<c:set var="color" value="tomato"/>
</c:when>
<c:when test="${dto.language == 'html'}">
<c:set var="color" value="gold"/>
</c:when>
<c:when test="${dto.language == 'css'}">
<c:set var="color" value="yellowgreen"/>
</c:when>
<c:when test="${dto.language == 'javascript'}">
<c:set var="color" value="orange"/>
</c:when>
<c:otherwise>
<c:set var="color" value="beige"/>
</c:otherwise>
</c:choose>
<div style="background-color: ${color};">${dto.language}</div>
<div>${dto.subject}</div>
<div>${dto.regdate}</div>
</div>
</c:forEach>
</div>
<div>
<button type="button" class="add" onclick="location.href='/code/add.do';">추가하기</button>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script>
$('#filter > input').click(function() {
let param = '';
/* 토글 버튼 */
if ($(this).data('selected') == 0) {
$(this).css('background-color', $(this).data('color'));
$(this).data('selected', '1');
} else {
$(this).css('background-color', '#FFF');
$(this).data('selected', '0');
}
$('#filter > input').each(function(index, item) {
if ($(item).data('selected') == '1') {
//alert($(item).data('language'));
param += 'language=' + $(item).data('language') + '&';
}
});
//alert(param);
location.href = '/code/list.do?' + param;
});
<c:forEach items="${language}" var="lang">
$('#filter input[data-language=${lang}]').data('selected', '1');
$('#filter input[data-language=${lang}]').css('background-color', $('#filter input[data-language=${lang}]').data('color'));
</c:forEach>
</script>
</body>
</html>
언어별로 색깔을 지정할 때 JSTL로 color라는 변수를 만들어서 지정할 색깔을 넣고, EL로 변수를 호출한다.
JSTL과 EL에 대해서는 위 글을 참고한다.
onclick="location.href='/code/view.do?seq=${dto.seq}';"
그리고 인라인 태그 안에는 블럭태그인 a 태그를 넣으면 안 되기 때문에 div 태그 안에 클릭 이벤트를 거는 방식으로 링크를 구현한다.
views.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="https://me2.do/5BvBFJ57">
<link rel="stylesheet" href="/code/resources/highlight/styles/github.min.css"> <!-- github 코드 스타일 -->
<style>
table > tr:nth-child(1) th {
width: 120px;
}
table > tr:nth-child(1) td {
width: auto;
}
#code {
margin: 1rem;
border: 1px solid #CCC;
}
#code * {
font-family: d2coding;
}
</style>
</head>
<body>
<!-- view.jsp -->
<h1>Code <small>view</small></h1>
<table>
<tr>
<th>번호</th>
<td>${dto.seq}</td>
<th>날짜</th>
<td>${dto.regdate}</td>
</tr>
<tr>
<td colspan="4">${dto.subject}</td>
</tr>
</table>
<pre id="code"><code class="language-${dto.language}"><c:out value="${dto.code}"/></code></pre>
<div>
<button type="button" class="back" onclick="location.href='/code/list.do';">돌아가기</button>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="/code/resources/highlight/highlight.min.js"></script>
<script>
hljs.highlightAll();
</script>
</body>
</html>
🍃highlight
https://highlightjs.org/download
code hightlighter를 다운로드 받고, 받은 파일을 webapp > resources 폴더 내에 넣는다.
그리고 ${dto.code}를 div가 아닌 pre 태그로 감쌌다.
다른 건 모두 잘 적용이 되지만, html의 경우 해석을 해버리기 때문에 c:out 태그를 이용한다.
add.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="https://me2.do/5BvBFJ57">
<style>
</style>
</head>
<body>
<!-- add.jsp -->
<h1>Code <small>add</small></h1>
<form method="POST" action="/code/addok.do">
<table class="vertical">
<tr>
<th>제목</th>
<td><input type="text" name="subject" required class="full"></td>
</tr>
<tr>
<th>코드</th>
<td><textarea name="code" required class="full"></textarea></td>
</tr>
<tr>
<th>언어</th>
<td>
<select name="language">
<option value="java">Java</option>
<option value="sql">SQL</option>
<option value="html">HTML</option>
<option value="css">CSS</option>
<option value="javascript">JavaScript</option>
</select>
</td>
</tr>
</table>
<div>
<button type="submit" class="add">추가하기</button>
<button type="button" class="back" onclick="location.href='/code/list.do';">돌아가기</button>
</div>
</form>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script>
</script>
</body>
</html>
form 안에 input 태그를 만들 때 컬럼 이름과 똑같이 name을 만들어 주었다.
addok.jsp 파일을 만들지 않았으므로 redirect로 입력에 실패하면 다시 입력 페이지로 돌아가고, 입력에 성공한 경우 list.do로 이동하도록 한다.
프로젝트 설정
- webapp > lib > ojdbc6.jar
Java Build Path > Classpath에서 ojdbc6.jar 파일을 추가한다.
script.sql
-- Code > script.sql
drop table tblCode;
drop sequence seqCode;
create table tblCode (
seq number primary key,
subject varchar2(1000) not null,
code varchar2(2000) not null,
regdate date default sysdate not null,
language varchar2(100) not null
);
create sequence seqCode;
code.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="code">
<insert id="add" parameterType="com.test.domain.CodeDTO">
insert into tblCode (seq, subject, code, regdate, language)
values (seqCode.nextval, #{subject}, #{code}, default, #{language})
</insert>
<select id="list" parameterType="java.util.List" resultType="com.test.domain.CodeDTO">
<!-- [java, css, js] -->
select seq, subject, regdate, language
from tblCode
<if test="list != null">
<where>
<foreach collection="list" item="lang" separator="or">
language = #{lang}
</foreach>
</where>
</if>
order by seq desc
</select>
<select id="get" parameterType="String" resultType="com.test.domain.CodeDTO">
select * from tblCode
where seq = #{seq}
</select>
</mapper>
namespace는 파일명이므로 "code"라고 작성하였다.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>code</artifactId>
<name>Code</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java-version>11</java-version>
<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.6.6</org.slf4j-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- @Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Servlet / JSP -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- log4jdbc.log4j2 -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4</artifactId>
<version>1.16</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- AOP -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<!-- JSON -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<!-- HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.4</version>
</dependency>
<!-- MyBatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.test.int1.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
</web-app>
filter에 url pattern을 걸어 두었기 떄문에 모든 요청에 대한 인코딩을 처리할 수 있다.
또는 servlet-name에 와일드 카드 대신에 appServlet을 작성할 수 있다.
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.test.code" />
<context:component-scan base-package="com.test.controller" />
<context:component-scan base-package="com.test.persistence" />
</beans:beans>
root-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
<property name="driverClassName"
value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy"></property>
<property name="jdbcUrl"
value="jdbc:log4jdbc:oracle:thin:@localhost:1521:xe"></property>
<property name="username" value="hr"></property>
<property name="password" value="java1234"></property>
</bean>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<constructor-arg ref="hikariConfig"></constructor-arg>
</bean>
<bean id="sessionfactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mapperLocations"
value="classpath*:mapper/*.xml"></property>
</bean>
<bean class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sessionfactory"></constructor-arg>
</bean>
</beans>
sessionfactory와 sessionbean을 설정하였다.
username, password, mapper부분에 변경이 있다면 수정하면 된다.
log4jdbc.log4j2.properties
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
log4j(log level)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console"
class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<!-- Application Loggers -->
<logger name="com.test.code">
<level value="info" />
</logger>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
<logger name="jdbc.audit">
<level value="warn" />
</logger>
<logger name="jdbc.resultset">
<level value="warn" />
</logger>
<logger name="jdbc.connection">
<level value="warn" />
</logger>
<logger name="jdbc.sqltiming">
<level value="off" />
</logger>
</log4j:configuration>