demo:

    https://github.com/xiaosawuhen/spring-boot-log

spring boot log存在两种形式

1.使用默认的logback

    直接在application.properties中设置

        ## spring boot log4j
	logging.level.org.springframework.web=INFO
	logging.level.guru.springframework.blogs.controllers=INFO
	logging.level.org.hibernate=ERROR
	logging.file=logs/spring-boot-logging.log


2.使用log4j


pom.xml

	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.9.RELEASE
	

	
    	1.8
		UTF-8
	

	
		
			org.springframework.boot
			spring-boot-starter-web
			
                  
                    org.springframework.boot  
                    spring-boot-starter-logging  
                  
			
		
		
			org.springframework.boot
			spring-boot-starter-log4j2
		
	


application.properties

	logging.config=classpath:log4j2.xml



log4j2.xml

	
	
		
		
			%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n
		
		
			
				
				
				
			
		
		
			
				
				
					${pattern}
				
			
			
				
				
					${pattern}
				
				
					
					
				
			
			
				
				
					${pattern}