在我的 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.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(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 运行应用程序**