How to use log4j in an Eclipse RCP?

后端 未结 3 1687
执笔经年
执笔经年 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:55

    i'm using log4j with my RCP app
    here's what you should do: just drop log4j plugin (you can get the 'osgified' version from Spring Bundle Repository) and then, drop it to the 'dropin' folder of your eclipse installation.
    then, you should add this plugin as a dependencie of your app and on your Activator class, do the following:
    URL confURL = getBundle().getEntry("log4j.properties"); PropertyConfigurator.configure(FileLocator.toFileURL(confURL).getFile());

    and drop this 'log4j.properties' on your root folder of your app
    sorry about my english

提交回复
热议问题