오픈강의 2014 logback

493 views

Published on

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
493
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

오픈강의 2014 logback

  1. 1. 로그관련 API 사용 log4j 에서 logback로 개선 류지만 ryu.jiman@gmail.com 010-7373-1732
  2. 2. 1. 기본 세팅 로그레벨 FATAL > ERROR > WARN > INFO > DEBUG > TRACE OFF
  3. 3. 1. 기본 세팅 /src/main/resources/logback.xml <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <timestamp key="bySecond" datePattern="yyyyMMddHH" /> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{yyyyMMdd HH:mm:ss,SSS}|%-5p|%5X{guid}|%-5X{logCode}|%-40F|%-5L|%m%n</pattern> </layout> </appender> <appender name="INTERFACE” class="ch.qos.logback.core.rolling.RollingFileAppender"> <prudent>true</prudent> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>/Users/jimanryu/Project/logs/logFile.%d{yyyy-MM-dd-HH}.log</fileNamePattern> <maxHistory>72</maxHistory> </rollingPolicy> <encoder > <pattern>%d{yyyyMMdd HH:mm:ss,SSS}|%-5p|%36X{guid}|%-14X{logCode}|%-40F|%-5L|%m%n</pattern> </encoder> </appender> <category name="org.springframework"> <priority value="INFO"/> <appender-ref ref="CONSOLE" /> </category> <root> <level value="DEBUG"/> <appender-ref ref="CONSOLE"/> </root> </configuration>
  4. 4. 1. 기본 세팅 Maven 프로젝트에서 pom.xml <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-access</artifactId> <version>1.0.13</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.0.13</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.13</version> </dependency> <dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jcl</artifactId> <version>1.7.5</version> </dependency>

×