Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [equinox-dev] Logging, exceptions, and the UserAdmin service

equinox-dev-bounces@xxxxxxxxxxx wrote on 2006-02-06 02:27:07 PM:

> I've done some more looking at this.  It looks like if you start or 
> stop a bundle from the console then the exception stack trace goes 
> to the console, 

This is because the console code calls the bundle life cycle methods and 
thus catches the exception. So it prints it out.

> but if the framework starts or stops the bundle, 
> exceptions go to the log. 

The framework publishes the exceptions as FrameworkEvent.ERRORs which are 
then captured by the log (who registered a FrameworkListener). So the 
framework does not log the exceptions, per se.


> If this is by design (which I assume it 
> is), then I would suggest that exceptions always be sent to the log 
> even if they also go to the console.  Does this sound reasonable? 
> If so, I'll log a enhancement request.

I suppose, but really the console is generally manned by someone 
intelligent (or at least a human :-) who has typed in some command and 
then wants a success or failure indication.

Again the framework does not send the exception to the log. The bundle 
lifecycle methods throw an exception and the receiver has to decide what 
to do. The console implementation could decide to dump all exceptions it 
encountered into the log as well as display them.

But how truly useful is this?

> 
> Also, is there an easy way to get the framework to stop a bundle to 
> verify that exceptions in the BundleActivator.stop() go to the log? 
> I've tried programmatically stopping a bundle from another bundle, 
> but then you end having to handle the exception yourself instead of 
> the framework handling it.

Try using StartLevel. By having some bundle at start level 100 for 
example, when you change the start level to 99, the framework must stop 
the bundle.

> 
> Ron
> 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx
Office: +1 407 849 9117 Mobile: +1 386 848 3788



Back to the top