1.boot implemented by slf4j + logback the unified management of the log, the purpose can be circumvented inconsistencies logging framework used in multiple projects
2. need to use in the configuration file when introducing a new project log frame reject
3.springboot call logging framework reference:
Logger logger= LoggerFactory.getLogger(getClass());
@Test
void contextLoads() {
logger.trace("trace ....");
logger.debug("debug ....");
logger.info("info ...");
logger.warn("warn ...");
logger.error("error ...");
}
3 may be arranged in the output path application.properties log, log format, as follows:
logging.level.com.baosight=debug
logging.file.path=D:/springlog/20200112_log
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss.SSS} ++[%thread] ++%-5level %logger{30} -%msg%n
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} ==[%thread] ==%-5level %logger{30} -%msg%n
4. Parameters to be configured as more time, can write a separate log file, when the file name logback-spring.xml, etc. can spring.profile.actived = dev batch activated by application.xml