newbie: how should bundle code log in equinox? [message #84975] |
Sat, 24 March 2007 07:35  |
Eclipse User |
|
|
|
I have successfully deployed an equinox app, standalone, with a simple bundle.
The trouble is I cannot see any log output from my bundle.
Question: what is the best way to log? My libraries already include commons-logging and log4j, plus of course java.util.logging. I am aware of bundle org.eclipse.equinox.log
Which logging option is best/preferred for plugins in Equinox?
Part (new)B: How do I do it? Where exactly do I put any .properties files?
MANY THANKS!
David
|
|
|
|
|
|
|
Re: newbie: how should bundle code log in equinox? [message #85067 is a reply to message #85035] |
Mon, 26 March 2007 07:05   |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
OK, if you have 1 bundle with 3 jars in it, you can just put the log4j.properties file in the root of the project and it will pick it up. You will need to make sure you edit build.properties to ensure that the bin.includes also lists this file (otherwise it won't be there when you export it).
If your bundle is ACTIVE, and there's a Bundle-Activator: com.foo.Activator, and that's your Activator's method, then yes, this code should have been run. In fact, if it didn't work (say, it couldn't create the file) and an exception occured, your bundle wouldn't be ACTIVE -- it would go back to RESOLVED.
Can you verify that the Bundle-Activator is indeed pointing to this class? If you mis-spell the entry (e.g. Bondle-Activator) then you'd get exactly this behaviour since it wouldn't find the entry and thus use a default of no activator.
Alex.
|
|
|
Re: newbie: how should bundle code log in equinox? [message #85082 is a reply to message #85067] |
Mon, 26 March 2007 09:54   |
Eclipse User |
|
|
|
Alex,
Once again you have lead me to the solution!
It turns out that after building, my MANIFEST.MF file was wrong. It had only 3 lines and was generated by the ant <jar...> command. You see, in order to assemble my standalone OSGi app, I am packaging it using ant. Probably not the preferred way, but I did not see a better way to package and deploy a standalone OSGi app from Eclipse.
So I had this in my build.xml file
<jar destfile="${destination.jar.file}">
and this ignored my bundle's META-INF/MANIFEST.MF file, and instead created its own MANIFEST.MF file.
I changed this ant directive to
<jar destfile="${destination.jar.file}" filesetmanifest="merge">
and now I get the proper MANIFEST.MF in my bundle's final jar file. My bundle is running, it is writing my test file, and I can see console output from my libraries (Jetty, etc). Looks like I might finally have a working development environment. Whew
MANY Thanks, Alex!
David
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03609 seconds