最簡單的配置spring
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.25</version> <!--<scope>test</scope>--> </dependency>
log4j.propertiesapache
log4j.rootLogger=DEBUG,A1 log4j.logger.cn.itcast = DEBUG log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c]-[%p] %m%n
springboot下的配置tomcat
logging: pattern: console: "%d - %msg%n" path: /var/log/tomcat/ file: /var/log/tomcat/sell.log level: com.imooc.LoggerTest: debug