100일 챌린지/빅데이터기반 인공지능 융합 서비스 개발자

Day 37 - Build tool 세팅하기 (Maven)

ksyke 2024. 9. 12. 11:57

목차

    Maven

    간편 실행

    • 자바로 만들어진 build tool

    https://maven.apache.org/

    https://maven.apache.org/guides/index.html

    https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

     

    압축을 푼 뒤 폴더를 path에 지정하고 cmd로 실행한다. 

    이후 아래 코드로 초기 세팅을 한다.

    mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

    ->jdk 1.8로 사용하기 위해 DarchetypeVersion을 1.4로 받는다. 

    pom.xml java 버전 바꾸기

    아래 코드를 실행해 패키지를 만든다.

    mvn package

    mvn 작업 지우기

     

    커스텀 실행

    mvn archetype:generate -DgroupId=com.gimhae -DartifactId=Day37_1 -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4

    eclipse에 maven 프로젝트 가져오기

    web 프로젝트로 실행하기

    mvn archetype:generate ^
        -DarchetypeGroupId=org.apache.maven.archetypes ^
        -DarchetypeArtifactId=maven-archetype-webapp ^
        -DarchetypeVersion=1.0^
        -DgroupId=com.home ^
        -DartifactId=Day37_3

    패키징 하기

    .war 파일이 만들어진걸 볼 수 있다. 

     

    프로젝트에 서버 추가하기 (서버가 없을 시)

     eclipse에서 maven으로 프로젝트만들기 

     

    maven build 하기

    [project] > [Run As] > [Maven Build]

    라이브러리 추가하기

    mysql

    https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.33

     

    // pom.xml에 추가 
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.33</version>
    </dependency>

     

    작동하는지 테스트하기

    <h2><%=new com.mysql.cj.jdbc.Driver().getClass() %></h2>

     

    JSTL

    https://mvnrepository.com/artifact/javax.servlet/jstl/1.2

    <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

     

    JSP

    https://mvnrepository.com/artifact/taglibs/standard/1.1.2

    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2</version>
        <scope>provided</scope>
    </dependency>

     

    작동하는지 테스트하기

     

    변수

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8" isELIgnored="false"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    	<h1>jstl step1</h1>
    	<ul>
    		<li><c:out value="abcd"></c:out></li>
    		<li><c:out value="abcd">ABCD</c:out></li>
    		<li><c:out value="<%=null %>">ABCD</c:out></li>
    		<li><c:set var="a1" value="abcd"></c:set></li>
    		<li>${a1}</li>
    		<li><c:out value="${a1 }">ABCD</c:out></li>
    		<li><c:set var="a2">aaaa</c:set></li>
    		<li><c:out value="${a2 }">ABCD</c:out></li>
    		<li><c:set var="a3" value="1111"></c:set></li>
    		<li><c:out value="${a3+1 }">ABCD</c:out></li>
    	</ul>
    	
    </body>
    </html>

     

    조건문

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8" isELIgnored="false"%>
        <%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    	<h1>jstl step2</h1>
    	<p>begin</p>
    	<c:if test="true">
    	<p>참1</p>
    	</c:if>
    	<c:if test="false">
    	<p>참2</p>
    	</c:if>
    	<p>end</p>
        
    	<h1>jstl step3</h1>
    	<u1>
    		<c:forEach begin="1" end="10" var="i">
    			<li>item<c:out value="${i }"></c:out></li>
    		</c:forEach>
    	</u1>
        
    </body>
    </html>

    Extension Language

    버전 올리기

    1) server의 web.xml의 web-app 버전 코드를 복사해서 프로젝트의 web.xml에 붙여넣는다.

    // web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee                       http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    
    <web-app>
      <display-name>Archetype Created Web Application</display-name>
    </web-app>

     

    2) 프로젝트의 pom.xml에 다음의 플러그인 코드를 추가한다.

     // pom.xml
     <build>
        <finalName>day37_5</finalName>
        <plugins>
        	<plugin>
    	    	<artifactId>maven-compiler-plugin</artifactId>
    	        <configuration>
    	            <source>1.8</source>
    	            <target>1.8</target>
    	        </configuration>
        	</plugin>
        </plugins>
      </build>

     

    3) 프로젝트의 .settings 폴더의 .xml 파일의 코드를 다음으로 업데이트한다. 

     

    4) 이후 Maven 프로젝트를 업데이트 후 실행한다. 

     

    EL의 표현식 정리 

    el language (el표현식)

    자료형 자바 el 출력 etc
    숫자(정수) <%=1233+1 %> ${1233+1 } ${1234 }
    숫자(실수) <%=3.14+1 %> ${3.14+1 } ${3.14 }
    문자열 <%="문자열" %> ${"문자열" } ${"문자열" }
    문자열 <%="문자열" %> ${'문자열' } ${'문자열' }
    boolean <%=true %> ${true } ${true}
    boolean <%=false %> ${false } ${false}
    객체 <% String msg=null; out.print(msg); %> ${null } ${null}
    연산자 <%=1+2 %> ${1+2 } ${1+2}
    연산자 <%=1.0+2 %> ${1.0+2 } ${1.0+2}
    연산자 <%=1-2 %> ${1-2 } ${1-2}
    연산자 <%=2*3 %> ${2*3 } ${2*3}
    연산자 <%=6/2 %> ${6/2 } ${6/2}
    연산자 <%=5/2 %> ${5/2 } ${5/2}
    연산자 <%=5%2 %> ${5%2 } ${5%2}
    연산자 <%=5/2 %> ${5 div 2 } ${5 div 2}
    연산자 <%=5/2 %> ${5 mod 2 } ${5 mod 2}
    비교연산 <%=5 > 2 %> ${5 > 2 } ${5 > 2}
    비교연산 <%=5 == 5 %> ${5 == 5 } ${5 == 5}
    비교연산 <%=5 == 5 %> ${5 eq 5 } ${5 eq 5}
    비교연산 <%=5 > 3 %> ${5 gt 3 } ${5 gt 3}
    비교연산 <%=5 < 3 %> ${5 lt 3 } ${5 lt 3}
    비교연산 <%=5 >= 3 %> ${5 ge 3 } ${5 ge 3}
    비교연산 <%=5 <= 3 %> ${5 le 3 } ${5 le 3}
    삼항연산자 <%=3>5?"크다":"작다" %> ${3>5?'크다':'작다' } ${3>5?'크다':'작다'}
    <body>
    	<h1>el language (el표현식)</h1>
    	<table>
    		<thead>
    			<tr>
    				<th>자료형</th>
    				<th>자바</th>
    				<th>el</th>
    				<th>출력</th>
    				<th>etc</th>
    			</tr>
    		</thead>
    		<tbody>
    			<tr>
    				<td>숫자(정수)</td>
    				<td><%=1233+1 %></td>
    				<td>${1233+1 }</td>
    				<td>${1234 }</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>숫자(실수)</td>
    				<td><%=3.14+1 %></td>
    				<td>${3.14+1 }</td>
    				<td>${3.14 }</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>문자열</td>
    				<td><%="문자열" %></td>
    				<td>${"문자열" }</td>
    				<td>${"문자열" }</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>문자열</td>
    				<td><%="문자열" %></td>
    				<td>${'문자열' }</td>
    				<td>${'문자열' }</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>boolean</td>
    				<td><%=true %></td>
    				<td>${true }</td>
    				<td>${true}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>boolean</td>
    				<td><%=false %></td>
    				<td>${false }</td>
    				<td>${false}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>객체</td>
    				<td><% String msg=null; out.print(msg); %></td>
    				<td>${null }</td>
    				<td>${null}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=1+2 %></td>
    				<td>${1+2 }</td>
    				<td>${1+2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=1.0+2 %></td>
    				<td>${1.0+2 }</td>
    				<td>${1.0+2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=1-2 %></td>
    				<td>${1-2 }</td>
    				<td>${1-2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=2*3 %></td>
    				<td>${2*3 }</td>
    				<td>${2*3}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=6/2 %></td>
    				<td>${6/2 }</td>
    				<td>${6/2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=5/2 %></td>
    				<td>${5/2 }</td>
    				<td>${5/2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=5%2 %></td>
    				<td>${5%2 }</td>
    				<td>${5%2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=5/2 %></td>
    				<td>${5 div 2 }</td>
    				<td>${5 div 2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>연산자</td>
    				<td><%=5/2 %></td>
    				<td>${5 mod 2 }</td>
    				<td>${5 mod 2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 > 2 %></td>
    				<td>${5 > 2 }</td>
    				<td>${5 > 2}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 == 5 %></td>
    				<td>${5 == 5 }</td>
    				<td>${5 == 5}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 == 5 %></td>
    				<td>${5 eq 5 }</td>
    				<td>${5 eq 5}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 > 3 %></td>
    				<td>${5 gt 3 }</td>
    				<td>${5 gt 3}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 < 3 %></td>
    				<td>${5 lt 3 }</td>
    				<td>${5 lt 3}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 >= 3 %></td>
    				<td>${5 ge 3 }</td>
    				<td>${5 ge 3}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>비교연산</td>
    				<td><%=5 <= 3 %></td>
    				<td>${5 le 3 }</td>
    				<td>${5 le 3}</td>
    				<td></td>
    			</tr>
    			<tr>
    				<td>삼항연산자</td>
    				<td><%=3>5?"크다":"작다" %></td>
    				<td>${3>5?'크다':'작다' }</td>
    				<td>${3>5?'크다':'작다'}</td>
    				<td></td>
    			</tr>
    		</tbody>
    	</table>
    </body>

     EL 문법

    <body>
    <%
    String msg="문자열";
    
    // scope
    // page > request > session >application
    session.setAttribute("msg", "session");
    application.setAttribute("msg","application");
    pageContext.setAttribute("msg", "page");
    request.setAttribute("msg", "req");
    
    pageContext.setAttribute("nalja", new java.util.Date());
    
    %>
    <ul>
    	<li>${msg }</li>
    	<li>${pageScope.msg }</li>
    	<li>${requestScope.msg }</li>
    	<li>${sessionScope.msg }</li>
    	<li>${applicationScope.msg }</li>
    	<li>${nalja }</li>
    	<li><%=request.getContextPath() %></li>
    	<li><%=pageContext.getRequest() %></li>
    	<li>${pageContext.request.contextPath }</li>
    </ul>
    
    </body>
    <body>
    <%
    String[] arr1={"item1","item2","item3","item4"};
    pageContext.setAttribute("arr1", arr1);
    %>
    	<h1>el arr</h1>
    	<ul>
    		<li>${arr1[0] }</li>
    		<li>${arr1[1] }</li>
    		<li>${arr1[2] }</li>
    		<li>${arr1[3] }</li>
    	</ul>
    <%@page import="java.util.*" %>
    <%
    ArrayList list=new ArrayList();
    list.add("list1");
    list.add("list2");
    list.add("list3");
    list.add("list4");
    pageContext.setAttribute("list",list);
    %>
    	<ol>
    		<li>${list[0] }</li>
    		<li>${list[1] }</li>
    		<li>${list[2] }</li>
    		<li>${list[3] }</li>
    	</ol>
    <%
    HashMap map=new HashMap();
    map.put("key1", "val1");
    map.put("key2", "val2");
    map.put("key3", "val3");
    map.put("key4", "val4");
    pageContext.setAttribute("map",map);
    %>	
    	<ul>
    		<li>${map['key1'] }</li>
    		<li>${map['key2'] }</li>
    		<li>${map['key3'] }</li>
    		<li>${map['key4'] }</li>
    	</ul>
    	<ul>
    		<li>${map.key1 }</li>
    		<li>${map.key2 }</li>
    		<li>${map.key3 }</li>
    		<li>${map.key4 }</li>
    	</ul>
    <%
    com.emp.model.EmpDto bean=new com.emp.model.EmpDto();
    bean.setEmpno(11111);
    bean.setPay(10000);
    bean.setEname("tester");
    bean.setHiredate(new Date());
    pageContext.setAttribute("bean",bean);
    %>	
    	<ul>
    		<li>${bean.empno }</li>
    		<li>${bean.ename }</li>
    		<li>${bean.pay }</li>
    		<li>${bean.hiredate }</li>
    	</ul>
    </body>

    JSTL 문법

    조건문

    <body>
    	<h1>jstl</h1>
    	<ul>
    		<li><c:out value="${1234 }"></c:out></li>
    		<li><c:out value="${3.14 }"></c:out></li>
    		<li><c:out value="${'abcd' }"></c:out></li>
    		<li><c:out value="${null }">abcd</c:out></li>
    		<li><c:set var="a1" value="${1234 }"></c:set></li>
    		<li>${a1>1111 }</li>
    		<li><c:set var="a2">${1234 }</c:set></li>
    		<li>${a2<1111 }</li>
    	</ul>
    </body>
    <head>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    </head>
    <body>
    	<h1>jstl 조건문</h1>
    	<c:set value="1" var="su"></c:set>
    	<c:if test="${su ge 0 }">
    		<p>양수</p>
    	</c:if>
    	<c:if test="${su le 0 }">
    		<p>음수</p>
    	</c:if>
    	<hr/>
    	<c:choose>
    		<c:when test="%{su gt 0}">양수</c:when>
    		<c:when test="%{su eq 0}">0</c:when>
    		<c:when test="%{su lt 0}">음수</c:when>
    		<c:otherwise>0</c:otherwise>
    	</c:choose>
    </body>

     

    반복문

    <%@ 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    	<h2>jstl 반복문</h2>
    	<c:forEach begin="1" end="10" var="i" step="2" varStatus="status">
    	<li>${i }
    			-${status.index }
    			-${status.count }
    			-${status.current }
    			-${status.first?"":"," }
    			-${status.last }
    	</li>
    	</c:forEach>
    	<h2>jstl 반복문</h2>
    <%
    	String[] arr1={"item1","item2","item3","item4"};
    	pageContext.setAttribute("arr1",arr1);
    %>
    	<ul>
    		<c:forEach items="${arr1 }" var="msg">
    			<li>${msg }</li>
    		</c:forEach>
    	</ul>
    <%
    	java.util.ArrayList list=null;
    	list=new java.util.ArrayList();
    	list.add("list1");
    	list.add("list2");
    	list.add("list3");
    	list.add("list4");
    	list.add(new com.emp.model.EmpDto(1,1111,"tester1",new java.util.Date()));
    	list.add(new com.emp.model.EmpDto(2,2222,"tester2",new java.util.Date()));
    	list.add(new com.emp.model.EmpDto(3,3333,"tester3",new java.util.Date()));
    	list.add(new com.emp.model.EmpDto(4,4444,"tester4",new java.util.Date()));
    	pageContext.setAttribute("list",list);
    %>
    	<ul>
    		<c:forEach items="${list }" var="bean">
    			<li>${bean.empno } - ${bean.ename } - ${bean.pay }</li>
    		</c:forEach>
    	</ul>
    </body>
    </html>

    토큰 사용하기

    <body>
    	<h1>jstl etc</h1>
    	
    <%
    	String msg="java,db,web,framework";
    pageContext.setAttribute("msg",msg);
    %>
    	<ul>
    		<c:forToken items="${msg}" delims="," var="item" >
    		<li>${item }</li>
    		</c:forToken>
    	</ul>
    </body>

    다른 파일 화면에 보여주기

    <body>
    	<h1>jstl etc2</h1>
    	<p>begin</p>
    	<c:import url="Ex07.jsp"></c:import>
    	<c:import url="http://google.com"></c:import>
    	<p>end</p>
    </body>

     

    BOM 제어하기

    <body>
    	<h1>jstl etc2</h1>
    	<div id="target">
    	<c:import url="https://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=159"></c:import>
    	</div>
    	<script type="text/javascript">
    	var div=document.querySelector('#target');
    	div.style.display='none';
    	document.querySelector('h1').outerHTML=document.querySelector('wf').innerHTML;
    	</script>
    </body>

     

    URL 패턴 작성

    	<h1>jstl etc3</h1>
    	<ul>
    		<li><c:url value="Ex08.jsp"></c:url></li>
    		<li><c:url value="Ex08.jsp">
    			<c:param name="id" value="admin"></c:param>
    			<c:param name="pw" value="1234"></c:param>
    		</c:url></li>
    		<li><c:url value="http://google.com/search" var="google">
    			<c:param name="q" value="java"></c:param>
    		</c:url></li>
    		<li>${google }</li>
    	</ul>

     

    redirect

    <body>
    	<c:redirect url="https://google.com/search">
    		<c:param name="q" value="java"></c:param>
    	</c:redirect>
    </body>

     

    jstl/fmt

    <body>
    <%
        pageContext.setAttribute("nalja",new java.util.Date());
        pageContext.setAttribute("pay",10000);
    %>
        <p><fmt:formatDate value="${nalja }" pattern="yyyy-MM-dd"/> </p>
        <p><fmt:formatNumber value="${pay }" pattern="###,###"/></p>
        <p><fmt:formatNumber value="${pay }" pattern="###,###원" var="p"/>aaa </p>
        <p>${p } </p>
        <p><fmt:parseNumber value="${pay }" var="p2"/></p>
        <p><fmt:formatNumber value="${p2 }" pattern="###,###원"/></p>
    </body>

    로그 프레임워크 - Log4j

    https://logging.apache.org/log4j/2.x/index.html

    https://logging.apache.org/log4j/1.x/

     

    Apache log4j 1.2 -

    End of Life On August 5, 2015 the Logging Services Project Management Committee announced that Log4j 1.x had reached end of life. For complete text of the announcement please see the Apache Blog. Users of Log4j 1 are recommended to upgrade to Apache Log4j

    logging.apache.org

    // pom.xml
    <!-- https://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

     

    properties 설정

    // log4j.properties
    # Set root logger level to DEBUG and its only appender to A1.
    log4j.rootLogger=DEBUG, A1
    
    # A1 is set to be a ConsoleAppender.
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    
    # A1 uses PatternLayout.
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=[%d{HH:mm:ss}]%C %M(...) - %m%n
    #%-4r [%t] %-5p %c %x - %m%n
    log4j.rootLogger=DEBUG, A1
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    
    # Print the date in ISO 8601 format
    log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
    
    # Print only messages of level WARN or above in the package com.foo.
    log4j.logger.com.foo=WARN

    파일에 log를 작성 

    // 가장 많이 사용되는 properties
    log4j.rootLogger=debug, stdout, R
    
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    
    # Pattern to output the caller's file name and line number.
    log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
    
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=example.log
    
    log4j.appender.R.MaxFileSize=100KB
    # Keep one backup file
    log4j.appender.R.MaxBackupIndex=1
    
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

    Log4j 사용하기

    public class Main {
    	static java.util.logging.Logger javaLog=java.util.logging.Logger.getGlobal();
    	
    /* Log Levels:
    	  	TRACE < DEBUG < INFO < WARN < ERROR < FATAL
    */
    /*
    	- %p debug, info, warn, error, fatal 등의 priority 가 출력된다.
    	- %m 로그내용이 출력됩니다
    	- %d 로깅 이벤트가 발생한 시간을 기록합니다. 포맷은 %d{HH:mm:ss, SSS}, %d{yyyy MMM dd HH:mm:ss, SSS}같은 형태로 사용하며 SimpleDateFormat에 따른 포맷팅을 하면 된다
    	- %d{ABSOLUTE}
    	- %d{DATE}
    	- %d{ISO8601}
    	- %t 로그이벤트가 발생된 쓰레드의 이름을 출력합니다.
    	- %% % 표시를 출력하기 위해 사용한다.
    	- %n 플랫폼 종속적인 개행문자가 출력된다. rn 또는 n 일것이다.
    	- %c 카테고리를 표시합니다 예) 카테고리가 a.b.c 처럼 되어있다면 %c{2}는 b.c가 출력됩니다.
    	- %C 클래스명을 포시합니다. 예)클래스구조가 org.apache.xyz.SomeClass 처럼 되어있다면 %C{2}는 xyz.SomeClass 가 출력됩니다
    	- %F 로깅이 발생한 프로그램 파일명을 나타냅니다.
    	- %l 로깅이 발생한 caller의 정보를 나타냅니다
    	- %L 로깅이 발생한 caller의 라인수를 나타냅니다
    	- %M 로깅이 발생한 method 이름을 나타냅니다.
    	- %r 어플리케이션 시작 이후 부터 로깅이 발생한 시점의 시간(milliseconds)
    	- %x 로깅이 발생한 thread와 관련된 NDC(nested diagnostic context)를 출력합니다.
    	- %X 로깅이 발생한 thread와 관련된 MDC(mapped diagnostic context)를 출력합니다. %X{key} 형태. 
    	*/
        
    	static Logger logger = Logger.getLogger(Main.class);
    	
    	public static void main(String[] args) {
    		javaLog.setLevel(Level.WARNING);
    		System.out.println("콘솔에 출력...");
    		javaLog.info("콘솔에 출력 로깅...");
    		logger.info("로깅 프레임워크로 출력...");
    	}
    }

    테스트 프레임워크 - JUnit

    https://junit.org/junit4/

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.13</version>
          <scope>test</scope>
        </dependency>