当前位置: 首页 > 工具软件 > Bio4j > 使用案例 >

java加载log4j_从java中的包加载log4j属性

郜琦
2023-12-01

在我的java swing应用程序中,我从存储在应用程序包中的属性文件中加载log4j属性,并将该属性文件加载为,

try {

PropertyConfigurator.configure("conf/log4j.properties");

logger.info("Starting the system.");

} catch (Exception e) {

e.printStackTrace();

}然后当应用程序启动时出现以下错误,

log4j:ERROR Could not read configuration file [conf/log4j.properties].

java.io.FileNotFoundException: conf/log4j.properties (No such file or directory)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.(FileInputStream.java:138)

at java.io.FileInputStream.(FileInputStream.java:97)

at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:297)

at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:315)

at com.bio.ofm.mnu.views.SplashScreen$1.run(SplashScreen.java:70)

at java.lang.Thread.run(Thread.java:722)

log4j:ERROR Ignoring configuration file [conf/log4j.properties].

log4j:WARN No appenders could be found for logger (com.bio.ofm.mnu.views.SplashScreen).

log4j:WARN Please initialize the log4j system properly.这种加载属性文件的方式是错误的吗?请帮忙。

我构建一个.jar文件并使用该jar来运行应用程序**

 类似资料: