SpringBoot日志输出

最简单的一个SpringBoot web日志

E:\software\jdk\bin\java -javaagent:E:\idea\ideaIC-2017.3.4.win\lib\idea_rt.jar=57831:E:\idea\ideaIC-2017.3.4.win\bin -Dfile.encoding=UTF-8 -classpath E:\software\jdk\jre\lib\charsets.jar;E:\software\jdk\jre\lib\deploy.jar;E:\software\jdk\jre\lib\ext\access-bridge-64.jar;E:\software\jdk\jre\lib\ext\cldrdata.jar;E:\software\jdk\jre\lib\ext\dnsns.jar;E:\software\jdk\jre\lib\ext\jaccess.jar;E:\software\jdk\jre\lib\ext\jfxrt.jar;E:\software\jdk\jre\lib\ext\localedata.jar;E:\software\jdk\jre\lib\ext\nashorn.jar;E:\software\jdk\jre\lib\ext\sunec.jar;E:\software\jdk\jre\lib\ext\sunjce_provider.jar;E:\software\jdk\jre\lib\ext\sunmscapi.jar;E:\software\jdk\jre\lib\ext\sunpkcs11.jar;E:\software\jdk\jre\lib\ext\zipfs.jar;E:\software\jdk\jre\lib\javaws.jar;E:\software\jdk\jre\lib\jce.jar;E:\software\jdk\jre\lib\jfr.jar;E:\software\jdk\jre\lib\jfxswt.jar;E:\software\jdk\jre\lib\jsse.jar;E:\software\jdk\jre\lib\management-agent.jar;E:\software\jdk\jre\lib\plugin.jar;E:\software\jdk\jre\lib\resources.jar;E:\software\jdk\jre\lib\rt.jar;D:\workspace\demo\target\classes;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.2.RELEASE\spring-boot-starter-web-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot-starter\1.5.2.RELEASE\spring-boot-starter-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot\1.5.2.RELEASE\spring-boot-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.2.RELEASE\spring-boot-autoconfigure-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.2.RELEASE\spring-boot-starter-logging-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\tianxuxu\.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\tianxuxu\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.24\jcl-over-slf4j-1.7.24.jar;C:\Users\tianxuxu\.m2\repository\org\slf4j\jul-to-slf4j\1.7.24\jul-to-slf4j-1.7.24.jar;C:\Users\tianxuxu\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.24\log4j-over-slf4j-1.7.24.jar;C:\Users\tianxuxu\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.2.RELEASE\spring-boot-starter-tomcat-1.5.2.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.11\tomcat-embed-core-8.5.11.jar;C:\Users\tianxuxu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.11\tomcat-embed-el-8.5.11.jar;C:\Users\tianxuxu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.11\tomcat-embed-websocket-8.5.11.jar;C:\Users\tianxuxu\.m2\repository\org\hibernate\hibernate-validator\5.3.4.Final\hibernate-validator-5.3.4.Final.jar;C:\Users\tianxuxu\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\tianxuxu\.m2\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;C:\Users\tianxuxu\.m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;C:\Users\tianxuxu\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.7\jackson-databind-2.8.7.jar;C:\Users\tianxuxu\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\tianxuxu\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.7\jackson-core-2.8.7.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-web\4.3.7.RELEASE\spring-web-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-aop\4.3.7.RELEASE\spring-aop-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-beans\4.3.7.RELEASE\spring-beans-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-context\4.3.7.RELEASE\spring-context-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-webmvc\4.3.7.RELEASE\spring-webmvc-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-expression\4.3.7.RELEASE\spring-expression-4.3.7.RELEASE.jar;C:\Users\tianxuxu\.m2\repository\org\slf4j\slf4j-api\1.7.24\slf4j-api-1.7.24.jar;C:\Users\tianxuxu\.m2\repository\org\springframework\spring-core\4.3.7.RELEASE\spring-core-4.3.7.RELEASE.jar com.txx.demo.DemoApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.2.RELEASE)

2018-03-20 18:34:40.901  INFO 8576 --- [           main] com.txx.demo.DemoApplication             : Starting DemoApplication on ZB-PF0XHGSW with PID 8576 (D:\workspace\demo\target\classes started by tianxuxu in D:\workspace\demo)
2018-03-20 18:34:40.904  INFO 8576 --- [           main] com.txx.demo.DemoApplication             : No active profile set, falling back to default profiles: default
2018-03-20 18:34:41.125  INFO 8576 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@140e5a13: startup date [Tue Mar 20 18:34:41 CST 2018]; root of context hierarchy
2018-03-20 18:34:43.644  INFO 8576 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-03-20 18:34:43.664  INFO 8576 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2018-03-20 18:34:43.665  INFO 8576 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.11
2018-03-20 18:34:43.798  INFO 8576 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-03-20 18:34:43.798  INFO 8576 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2677 ms
2018-03-20 18:34:43.967  INFO 8576 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-03-20 18:34:43.971  INFO 8576 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-20 18:34:43.971  INFO 8576 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-20 18:34:43.971  INFO 8576 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-20 18:34:43.971  INFO 8576 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-20 18:34:44.267  INFO 8576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@140e5a13: startup date [Tue Mar 20 18:34:41 CST 2018]; root of context hierarchy
2018-03-20 18:34:44.354  INFO 8576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-03-20 18:34:44.355  INFO 8576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-20 18:34:44.384  INFO 8576 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-20 18:34:44.384  INFO 8576 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-20 18:34:44.419  INFO 8576 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-20 18:34:44.598  INFO 8576 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-03-20 18:34:44.663  INFO 8576 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-03-20 18:34:44.667  INFO 8576 --- [           main] com.txx.demo.DemoApplication             : Started DemoApplication in 4.185 seconds (JVM running for 4.692)

首先日志打印图像
输出的每一个节点包含以下信息

2018-03-20 18:34:44.667  INFO 8576 --- [           main] com.txx.demo.DemoApplication             : Started DemoApplication in 4.185 seconds (JVM running for 4.692)

1.日期时间精确到微秒,方便日志排序
2.日志级别,ERROR,WARNING,INFO,DEBUG,TRACE。
3.ProcessID
4.分隔符—区分实际日志信息开头。
5.线程名,方括号中,可能被截断
6.日志名,通常为Class类名,缩写
7.日志信息。

LogBack没有Fatal级别,映射到ERROR

当debug启用核心日志会变多,但不会输出所有信息
–debug –trace 或者trace=true能够追踪核心日志

日志的自定义配置
Logback扩展。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值