springboot log4j 日志配置 没起作用

  • Post author:
  • Post category:其他



解决办法:在启动main 函数加载 日志配置文件

log4j.properties

@SpringBootApplication
public class AdapterApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdapterApplication .class, args);

        // 日志配置
        URL logConfigURL = AdapterApplication.class.getResource("/config/properties/log4j.properties");
        PropertyConfigurator.configure(logConfigURL);
    }
}
 



版权声明:本文为zhan107876原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。