250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- spring
- SpringBoot
- git
- Docker
- Tomcat
- maven
- 문서
- jpa
- Spring Boot
- MSSQL
- Open Source
- JDBC
- IntelliJ
- PostgreSQL
- 오픈소스
- AJAX
- JavaScript
- Source
- Python
- STS
- 설정
- oracle
- Thymeleaf
- error
- myBatis
- Core Java
- Exception
- Eclipse
- ubuntu
- MySQL
Archives
- Today
- Total
헤르메스 LIFE
[Spring] 개발환경 구축 - Logback 본문
728x90
Spring 개발환경을 갑자기 구축하려고 하다보니, 막막합니다.
하나 하나 구축해 보겠습니다
개발환경
Spring 4.3.30.RELEASE
MAVEN 3.8.4
Logback 1.2.9
pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SimpleSpring4</groupId>
<artifactId>SimpleSpring4</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SimpleSpring4</name>
<description>Simple Spring4</description>
<properties>
<springframework.version>4.3.30.RELEASE</springframework.version>
<org.slf4j-version>1.7.30</org.slf4j-version><!-- 1.7.26 -->
<ch.qos.logback-version>1.2.9</ch.qos.logback-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<!-- Bridge -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${ch.qos.logback-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId><!-- logback을 slf4j-api에서 사용함을 의미 -->
</exclusion>
</exclusions>
<scope>runtime</scope><!-- runtime 시 사용함 -->
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>
</project>
HelloController.java
package simple.spring.basic;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HelloController {
private static Logger logger = LoggerFactory.getLogger( HelloController.class);
@RequestMapping(value = { "/", "/welcome" }, method = RequestMethod.GET)
public String getHomePage( ModelMap model ) {
logger.info("[HelloController.getHomePage] 여기가 실행될까..?");
return "index";
}
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello( Map<String, Object> model ) {
logger.info("[HelloController.hello] Hello World");
model.put("name", "Spring4 MVC");
model.put("msg", "Hello World");
return "hello";
}
}
https://hermeslog.tistory.com/647
https://hermeslog.tistory.com/448
728x90
'Spring Framework' 카테고리의 다른 글
[Spring] 개발환경 구축 - File Upload (1) | 2022.12.26 |
---|---|
[Spring] 개발환경 구축 - MessagesSource (0) | 2022.12.22 |
[Spring] 개발환경 구축 - Hello World (0) | 2022.12.20 |
[Maven] 로컬 Dependency (0) | 2022.12.16 |
[log4j2] Log4j2 설정 참고 (0) | 2022.12.11 |