[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Using Log4J in Equinox framework

On Thu, Jun 4, 2009 at 4:28 PM, David Conde <dconde@xxxxxxxx> wrote:

Hi, thank you very much for your answer.


I have tried to download the Pax Logging binary file but I have got error with the web site.


If I am not wrong, the idea would be included paxlogging bundle as a required bundle, in order to get the libraries log4j and common-logging, to launch this bundle and use in my bundle log4j as the same way as I did without Equinox I mean in normal java applications, am I missing anything?


By the way, why I can’t to load the library org.apache.log4j.jar in my bundle and simply to use it? If I have to use other external libraries, what would I have to do in order to be able to use in Equinox framework?

I think the simplest way you want is to change a log4j Jar file to a log4j bundle. Just create a new bundle project, put log4j.jar in the bundle directory, add log4j.jar to the project build path, export all the packages in log4j.jar,(through Export-Package in bundle's MANIFEST.MF), add log4j to the bundle class path (through Bundle-Classpath in bundle's MANIFEST.MF). And then you get a log4j bundle which can run on Equinox.
You want to use log4j APIs, just import log4j package in other bundle (through Import-Package in bundle's MANIFEST.MF) and use it directly. But in this way, loading of the configuration file log4j.properties is a problem. log4j.properties can locate in the jar bundle or use a argument to figure it out.

So using pax log is a better way to resolve the class loader problem.

Thank you in advance





De: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] En nombre de Laidlaw, Don
Enviado el: miércoles, 03 de junio de 2009 14:40
Para: Equinox development mailing list
Asunto: Re: [equinox-dev] Using Log4J in Equinox framework


PAX Logging at http://wiki.ops4j.org/display/paxlogging/Pax+Logging is a good solution, and the one I use. Another good solution is SLF4J at http://www.slf4j.org/.

Both of those implement the log4j logging API and use standard log4j configuration property/xml formats for configuration, which is convenient if that is what you know.

Both of those also implement Commons Logging and other logging APIs making it very convenient in an OSGi container!
Best Regards,

Don Laidlaw | Sr. Research Engineer |
Infor | office: +1 902-576-5185 | mobile: +1 902-401-6771 | don.laidlaw@xxxxxxxxx

From: David Conde <dconde@xxxxxxxx>
Reply-To: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Date: Wed, 3 Jun 2009 13:01:18 +0200
To: 'Equinox development mailing list' <equinox-dev@xxxxxxxxxxx>
Subject: [equinox-dev] Using Log4J in Equinox framework

I have been trying to use org.apache.lo4j jar in Equinox but I got an exception :
Java.lang.Error Unresolved compilation problems:
The import org.apache cannot be resolved
My framework is not able either to recognize or load this library.
I have in my Activator. Java  the next one:
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
Furthermore, I included org.apache.log4j.jar in my classpath, either I installed this library like a bundle. I also tried to install the bundle from Orbit which implemented log4J, but I always have the same result.
Does anyone know what I have to do to use org.apache.log4J in Equinox?
I have either include import org.apache.log4j in Manifest.MF, I guess that there is a way to load external libraries in Equinox framework, other times I tried directly installing the jar file and it was fine, but with org.apache.lo4j jar there is no way to get a good result.
Any idea?
I am using Equinox by Console, not through Eclipse.
Thank you in advance

equinox-dev mailing list

equinox-dev mailing list