From a7e7edb877abc658dfb3b9393121d9d423d71f3b Mon Sep 17 00:00:00 2001
From: "yangkai.shen" <237497819@qq.com>
Date: Mon, 13 Nov 2017 15:24:48 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20logback=20=E7=9A=84=20READ?=
=?UTF-8?q?ME.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
spring-boot-demo-logback/README.md | 122 +++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
create mode 100644 spring-boot-demo-logback/README.md
diff --git a/spring-boot-demo-logback/README.md b/spring-boot-demo-logback/README.md
new file mode 100644
index 0000000..f6ebcab
--- /dev/null
+++ b/spring-boot-demo-logback/README.md
@@ -0,0 +1,122 @@
+# spring-boot-demo-logback
+
+依赖 [spring-boot-demo-helloworld](../spring-boot-demo-parent)
+
+### pom.xml
+
+```xml
+
+
+ 4.0.0
+
+ spring-boot-demo-logback
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-boot-demo-logback
+ Demo project for Spring Boot
+
+
+ com.xkcoding
+ spring-boot-demo-parent
+ 0.0.1-SNAPSHOT
+ ../spring-boot-demo-parent/pom.xml
+
+
+
+ spring-boot-demo-logback
+
+
+
+```
+
+### SpringBootDemoLogbackApplication.java
+
+```java
+@SpringBootApplication
+@Slf4j
+public class SpringBootDemoLogbackApplication {
+
+ public static void main(String[] args) {
+ ConfigurableApplicationContext context = SpringApplication.run(SpringBootDemoLogbackApplication.class, args);
+ int length = context.getBeanDefinitionNames().length;
+ log.trace("Spring boot启动初始化了 {} 个 Bean", length);
+ log.debug("Spring boot启动初始化了 {} 个 Bean", length);
+ log.info("Spring boot启动初始化了 {} 个 Bean", length);
+ log.warn("Spring boot启动初始化了 {} 个 Bean", length);
+ log.error("Spring boot启动初始化了 {} 个 Bean", length);
+ try {
+ int i = 0;
+ int j = 1 / i;
+ } catch (Exception e) {
+ log.error("【SpringBootDemoLogbackApplication】启动异常:", e);
+ }
+ }
+}
+```
+
+### application.yml
+
+```yml
+server:
+ port: 8080
+ context-path: /demo
+spring:
+ application:
+ name: logback-demo
+```
+
+### logback-spring.xml
+
+```xml
+
+
+
+
+
+
+
+
+ 【xkcoding】%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
+
+
+
+
+
+
+
+
+ ${user.dir}/logs/log/logback-demo.%d.log
+
+
+ 【xkcoding】%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n
+
+
+
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+
+
+ ${user.dir}/logs/error/logback-demo.%d.error
+
+
+ 【xkcoding】%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+```
\ No newline at end of file