Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » virgo logging(Is it the Logger or the blueprint?)
virgo logging [message #750541] Tue, 25 October 2011 20:49 Go to next message
Geoffry Roberts is currently offline Geoffry Roberts
Messages: 27
Registered: March 2011
Junior Member
All,

I said in an earlier post, I'm switching to Virgo from Karaf. In doing so, I have discovered an issue with logging. I deployed some bundles in Virgo that had worked well in Karaf. These are your basic Hello World type things. i.e. They are supposed to print to sysout upon start up and that's all. In Karaf they work. I see their output on the console, but in Virgo, nothing. I checked the log file ($VIRGO_HOME/serviceability/logs/log.log) and nothing. I changed from System.out.println to Logger Log = Logger.getLogger(ClientAPI.class); and still nothing.

Is the problem in my logging set up or with blueprint?

Below I list a class and below that the blueprint from OSGI-INF/blueprint/configuration.xml. Please note that the blueprint has an attribute: init-method="startUp".

Could it be that this method is not being called?

My code:

package clientapi;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import firstapi.API;

public class ClientAPI {

Logger Log = LoggerFactory.getLogger(ClientAPI.class);

API blueAPI = null;
API redAPI = null;

public void startUp() {
Log.debug("Hello world.");
Log.debug("startUp=====>" + this.getClass().getName());
Log.debug("getBlue==>" + blueAPI.getAPI());
Log.debug("getRed==>" + redAPI.getAPI());
}

public void setBlue(API api) {
Log.debug("setAPI==>" + api.getAPI());
this.blueAPI = api;
Log.debug("<==setAPI");
}

public void setRed(API api) {
Log.debug("setAPI==>" + api.getAPI());
this.redAPI = api;
Log.debug("<==setAPI");
}
}

The blueprint:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http---www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http---www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="blueprint.xsd">

<reference id="blueAPI" interface="firstapi.API" component-name="blueAPI" />
<reference id="redAPI" interface="firstapi.API" component-name="redAPI" />

<bean id="clientapi" class="clientapi.ClientAPI" init-method="startUp">
<property name="blue" ref="blueAPI" />
<property name="red" ref="redAPI" />
</bean>
</blueprint>
Re: virgo logging [message #751974 is a reply to message #750541] Wed, 26 October 2011 08:19 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Virgo does not by default include the blueprint service, so your blueprint is being ignored. Virgo currently includes Spring DM 1.2.1 and if you want the blueprint service, you have to add Gemini Blueprint yourself.

See bug 317943 for the enhancement to replace Spring DM 1.2.1 with the blueprint service, to make the latter available by default.

The bug also points at a forum thread where someone explains how to use Gemini Blueprint in Virgo.

There is also another thread and a bug where I explain what to do in some detail.

(Another alternative would be to re-code your bundle to use Spring DM 1.2.1, but you may regard that as a retrograde step and prefer to add Gemini Blueprint to Virgo until bug 317943 is implemented.)
Re: virgo logging [message #753199 is a reply to message #751974] Wed, 26 October 2011 17:16 Go to previous messageGo to next message
Geoffry Roberts is currently offline Geoffry Roberts
Messages: 27
Registered: March 2011
Junior Member
I neglected to mention that I do have Gemini installed.

To wit:
org.eclipse.gemini.blueprint.core: 1.0.0.RELEASE
org.eclipse.gemini.blueprint.extender: 1.0.0.RELEASE
org.eclipse.gemini.blueprint.io: 1.0.0.RELEASE

As an experiment, I removed Gemini and replaced it with Aries, but still no output if I am using Virgo.

So, do we have a bug?

PS
I did set every logger defined in serviceability.xml to DEBUG.
Re: virgo logging [message #753419 is a reply to message #753199] Thu, 27 October 2011 07:57 Go to previous message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I think the next step is to run Virgo in debug mode, as in the user guide, and attach a debugger and put a breakpoint on the startUp method to see whether or not it is driven. If it is driven, then it would also be worth stepping through the logging calls coarsley while you are there to see what happens to the flow.
Previous Topic:blueprint
Next Topic:Service referencing
Goto Forum:
  


Current Time: Sun Sep 21 22:14:41 GMT 2014

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

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