How to use log4j in an Eclipse RCP?

后端 未结 3 1692
执笔经年
执笔经年 2020-12-18 02:39

How to use log4j logging API in an Eclipse RCP project?

As a workaround U tried to create a new OSGI Bundle which has a log4j jars, below is the bundle structure:

3条回答
  •  暖寄归人
    2020-12-18 02:48

    1. Add log4j.jar in your project.
    2. Add the reference in MANIFEST.MF. Require-Bundle: org.apache.log4j;bundle-version="1.2.15"
    3. Add the reference in build.properties.

    bin.includes = plugin.xml,\ META-INF/,\ .,\ lib/log4j-1.2.17.jar

    1. Use the logger in .java files.

    PropertyConfigurator.configure(log4jConfPath); LOGGER.debug("STARTING APPLICATION ..");

    I found this tutorial helpful. Please check - Add log4j to RCP Application

提交回复
热议问题