简体   繁体   中英

How do I configure spring boot default logging pattern in log4j for maven?

I want my maven application logs to be written in below format, I have tried many patterns I know but it didn't print as expected please help me out

2019-03-05 10:57:51.112  INFO 45469 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.52
2019-03-05 10:57:51.253  INFO 45469 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-03-05 10:57:51.253  INFO 45469 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1358 ms

To achieve use this pattern:

%d{yyyy-MM-dd HH:mm:ss.SSS} %p ${PID:- } --- [%t] %c : %msg%n

More about pattern can be found on this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM