如何在eclipse rcp项目中使用log4j logging API?作为一种解决方法,我尝试创建一个具有log4j jar的新OSGI Bundle,下面是bundle结构。如何在eclipse rcp中使用log4j
我装箱,以期(模板)命名loggingtest .I've基本RCP应用程序包含在loggingtest project.In活化剂的依赖性选项卡捆绑的log4j启动方法我把下面的代码
Logger logger = Logger.getLogger(Activator.class);
logger.info("Info starting");
logger.warn("Warning starting");
logger.error("Error starting");
所以一切都很好,到目前为止我能使用log4j的API,并完成了一半,我感到不解的地方放置log4j.prope rties文件,我如何继续进一步获取所有日志语句的日志文件。
更精确下面是我的清单文件的loggingtest项目
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LoggingTest
Bundle-SymbolicName: LoggingTest; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: loggingtest.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
log4j;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
只要有人不依赖于log4j,Eclipse RCP就会提供自己的日志工具 - https://wiki.eclipse.org/FAQ_How_do_I_use_the_platform_logging_facility%3F,它可以让您在Eclipse平台上工作而无需手动入侵。 –