Use the Spring Boot default log frame Logback.
The benefit of all these POM dependencies is that it provides a good basis for developing Spring applications. The third-party library selected by Spring Boot is considered and is a better choice for product development. But Spring Boot also offers different options, such as the log framework can be used with logback or log4j, and the application server can use Tomcat or Jetty.
http://www.ibm.com/developerworks/cn/java/j-lo-spring-boot/
Color log implementation in spring boot
When you start the Spring boot application in the shell, it's interesting to see that its logger output is colored.
This setting can be used to turn off:
spring.output.ansi.enabled=false
The principle is to get this configuration through Ansioutputapplicationlistener, and then set the Logback in the output, add a colorconverter, Some of the fields are rendered by org.springframework.boot.ansi.AnsiOutput.
Gets the PID of the process
Applicationpid, the PID can be obtained.
Private StringGetpid(){Try{String Jvmname= Managementfactory.Getruntimemxbean().getname (return jvmname. Split ([0 catch (throwable ex{return null; } } /span>
Packaging Logger Class
Spring boot in the packaging of a set of logger, support for Java, log4j, Log4j2, Logback, after the need for their own packaging logger, can refer to this.
Under the Org.springframework.boot.logging package.
Gets the original Startup main function
The main function is determined by the method obtained in the stack, and the main function of the original startup is found.
Private Class<?>Deducemainapplicationclass(){Try{stacktraceelement[] StackTrace=NewRuntimeException().Getstacktrace();For(Stacktraceelement stacktraceelement: StackTrace){If("Main".equals(stacktraceelement.Getmethodname())){Return Classforname (stacktraceelement getclassname (} } } catch (classnotfoundexception ex< Span class= "token punctuation") {//Swallow and Continue } return null /span>
Https://yq.aliyun.com/articles/6056?spm=5176.100240.searchblog.20.i049N1#2
Http://www.cnblogs.com/wangdaijun/p/5446924.html
Spring Boot boot process parsing logback