简单日志项目

1、pom.xml



         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4.0.0

    com.ebc
    log-test
    1.0

    
        
            org.springframework.boot
            spring-boot-starter-logging
            2.1.3.RELEASE
            
                
                    log4j-to-slf4j
                    org.apache.logging.log4j
                
            
        
        
            org.projectlombok
            lombok
            1.18.6
            provided
        

    

 

2、logback.xml(可不写)


xmlns="http://ch.qos.logback/xml/ns/logback" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback
https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd">



%msg%n







 

3、ListenerTest1.java

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ListenerTest1 {
    public static void main(String[] args) {
        log.info("{}","hello world");
    }
}

输出:

09:23:44.765 [main] INFO com.ebc.ListenerTest1 - hello world

 

你可能感兴趣的:(简单日志项目)