virgo logging [message #750541] |
Tue, 25 October 2011 16:49  |
Eclipse User |
|
|
|
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 #753419 is a reply to message #753199] |
Thu, 27 October 2011 03:57  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.24880 seconds