Skip to main content



      Home
Home » Eclipse Projects » Virgo » How to detect log4j config file in bundle fragment
How to detect log4j config file in bundle fragment [message #760465] Fri, 02 December 2011 08:28 Go to next message
Eclipse UserFriend
Hello.

I am trying to OSGi-ify a third party project. This project depends on log4j for logging and I find that the log4j configuration file is not detected at runtime, which, after a little research, I discover is a typical problem with OSGi.

I have therefore created a fragment whose host bundle is com.springsource.org.apache.log4j and which contains the log4j config file under its META-INF directory. How do I make sure that the fragment is started by Virgo?

Is this even the right approach?

TIA,
B.

[Updated on: Fri, 02 December 2011 08:30] by Moderator

Re: How to detect log4j config file in bundle fragment [message #760491 is a reply to message #760465] Fri, 02 December 2011 09:43 Go to previous messageGo to next message
Eclipse UserFriend
Hello Barbara,

You should place your fragment in $SERVER_HOME/repository/usr and it will be attached to its host bundle.

Lazar
Re: How to detect log4j config file in bundle fragment [message #760492 is a reply to message #760465] Fri, 02 December 2011 09:46 Go to previous messageGo to next message
Eclipse UserFriend
Fragment is not started per se. Virgo will scan repository for any fragments when starting a bundle and attach them to the host when starting the host.

Deploying fragment at runtime does not automatically causes host bundle to re-deploy. You have to manually call refresh on host for it to pick up new fragments.


As for the logging - Virgo is going to pipe all of the logging for commons-loggin, log4j, slf4j through logback logging bridge provided by medic.

There is a way to attach a logback.xml configuration in bundle. I think it has to be at root of the bundle. Not sure that providing log4j properties will be picked up in any case.

You can also try to modify $virgo_home/config/serviceability.xml and provide configuration in there.

Dmitry
Re: How to detect log4j config file in bundle fragment [message #760500 is a reply to message #760492] Fri, 02 December 2011 10:09 Go to previous messageGo to next message
Eclipse UserFriend
Thank you both.

I will experiment and report.

[Updated on: Fri, 02 December 2011 10:09] by Moderator

Re: How to detect log4j config file in bundle fragment [message #760504 is a reply to message #760465] Fri, 02 December 2011 10:52 Go to previous message
Eclipse UserFriend
I've seen users put log4j properties in WEB-INF/classes/log4j.properties although I can't remember off-hand whether this works. I guess the corresponding thing in a bundle would be anywhere on the bundle classpath (at the root of the bundle if bundle-classpath is not specified).

See also http://logback.qos.ch/manual/migrationFromLog4j.html.
Previous Topic:Install failed for bundle ### version '0.0.0'.
Next Topic:Virgo 3.0.1 startu failed error
Goto Forum:
  


Current Time: Sat May 17 06:27:20 EDT 2025

Powered by FUDForum. Page generated in 0.04612 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top