运行Fargate任务时,出现间歇性的“无法初始化类org.apache.logging.log4j.LogManager”异常。
Spring-boot应用程序Java基础镜像
该应用程序在90%的时间内都能正常运行,但有时对存储在ECR中的映像没有任何更改,会出现以下错误
Instantiation of bean failed; nested exception is
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.logging.log4j.LogManager我已经在本地运行了该应用程序,但此问题从未发生过。
如何创建记录器
private static Logger LOGGER = LogManager.getLogger(CollectorController.class);发布于 2019-04-10 20:07:45
在您的主应用程序中
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SpringBootApplication
public class CollectorController {
private static final Logger logger = LoggerFactory.getLogger(CollectorController.class);
public static void main(String[] args) {
SpringApplication.run(IslandgreenApplication.class, args);
}
}在application.properties文件中添加以下内容
logging.file=C:/Users/A Majutharan/Documents/sun3/island_green/islandgreen/src/main/resources/\
LogFiles/app.log(this is the storing path)https://stackoverflow.com/questions/55608795
复制相似问题