[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [equinox-dev] Logging, exceptions, and the UserAdmin service
|
I was thinking that exceptions thrown while executing a
console command would go to both the console and the log. But you make a
good point about the framework not logging exceptions it didn't handle,
duplicate log entries, etc. Like I said to BJ, I'm still figuring out how
all the OSGi pieces fit together, which is why I was asking.
:-)
Ron
In general the framework should
not be logging exceptions that are not handled by the framework (i.e. any
propagated exceptions). This is because the caller may want to handle
the exception themselves and not cause an error condition, or they may
consider the exception an error and log the exception themselves. The
problem is the caller will not be able to tell if the exception was logged by
the framework already and that will cause duplicate log entries or the caller
may not consider the exception an error case but the log will be filled with
an exception even though no error occurred according to the caller.
Do you want the console impl (the caller
to Bundle#start()) to log the exception or the framework?
Tom.
"Ron Baldwin"
<Ron.Baldwin@xxxxxxxxxxxxxxx> Sent by: equinox-dev-bounces@xxxxxxxxxxx
02/06/2006 01:27 PM
Please respond
to Equinox development mailing list
<equinox-dev@xxxxxxxxxxx> |
|
To
| "Equinox development mailing
list" <equinox-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| RE: [equinox-dev] Logging,
exceptions, and the UserAdmin service |
|
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, but if the framework starts or stops the bundle,
exceptions go to the log. 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.
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.
Ron
From: equinox-dev-bounces@xxxxxxxxxxx
[mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of Jeff
McAffer
Sent: Saturday, February 04, 2006 8:23 AM
To:
Equinox development mailing list
Subject: RE: [equinox-dev] Logging,
exceptions, and the UserAdmin service
yup. bug reports are good. reports with
patches are even better ;-)
Thanks Ron.
Jeff
"Ron Baldwin"
<Ron.Baldwin@xxxxxxxxxxxxxxx> Sent by:
equinox-dev-bounces@xxxxxxxxxxx
02/02/2006 07:57 PM
Please respond
to Equinox development mailing list |
|
To
| "Equinox
development mailing list"
<equinox-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| RE: [equinox-dev]
Logging, exceptions, and the UserAdmin
service |
|
Doh. I
completely missed the log command when I was looking at the console commands.
That would have come in handy a few days ago. :-/
I have
verified that exceptions are logged for BundleActivator start() and
Declarative Services activate()/deactivate(), and when parsing malformed
activator.xml files. However, BundleActivator stop() does not log and
instead the exceptions are sent to stdout. I assume this is a bug I
should log?
Ron
From: equinox-dev-bounces@xxxxxxxxxxx
[mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of Roy
Paterson
Sent: Thursday, February 02, 2006 10:01 AM
To:
Equinox development mailing list
Subject: Re: [equinox-dev] Logging,
exceptions, and the UserAdmin service
In answer to your question #2, Declarative
Services logs to the LogService in all of those cases. I'm pretty sure
that BundleActivator start() and stop() go to LogService as well. Try
running with -console and using the "log" console command.
Regards,
Roy
-----------------------------------------
Roy
Paterson
IBM Pervasive Computing
Austin, TX
Phone: (512)
838-8898
"Ron Baldwin"
<Ron.Baldwin@xxxxxxxxxxxxxxx> Sent by:
equinox-dev-bounces@xxxxxxxxxxx
02/01/2006 04:29 PM
Please respond
to Equinox development mailing list
<equinox-dev@xxxxxxxxxxx> |
|
To
| "Equinox development
mailing list" <equinox-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| [equinox-dev] Logging,
exceptions, and the UserAdmin
service |
|
Hi,
I have a few issues
that I'm having difficulty finding information on.
I would appreciate any
assistance or pointers to documentation.
1. Do messages logged with
org.eclipse.equinox.log get persisted to disk
anywhere, or do you have to
have a listener to get them? If a listener
is required, what's the
best practices way of making sure your listener
is running before log
messages are generated?
2. Do errors get logged somewhere when a
BundleActivator start() or
stop() method throws an exception? Also,
I'm not seeing any errors when
the activate() and deactivate() methods for
declarative services throw,
or when an activator.xml file is malformed.
Instead everything just
fails silently.
3. I'm trying to use
org.eclipse.equinox.useradmin which requires me to
load
org.eclipse.equinox.preferences and org.eclipse.equinox.registry.
Although
all show as active in the console, I can't get a reference to
the UserAdmin
service which I'm guessing is due to the log messages (see
below) generated
on start up. What am I missing here?
Thanks in
advance,
Ron
!SESSION 2006-02-01
16:14:38.501
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_06
java.vendor=Sun
Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32,
NL=en_US
Command-line arguments:
-dev
file:D:/Dev/Users/Rbaldwin/Eclipse/workspace/.metadata/.plugins/org.ecli
pse.pde.core/OSGi
testing/dev.properties -console -os win32 -ws win32
-arch x86
!ENTRY
org.eclipse.osgi 4 0 2006-02-01 16:14:39.689
!MESSAGE An unexpected runtime
error has occurred.
!STACK 0
java.lang.NullPointerException
at
org.eclipse.core.internal.preferences.PreferencesService.getPrefExtensio
ns(PreferencesService.java:1134)
at
org.eclipse.core.internal.preferences.PreferencesService.initializeScope
s(PreferencesService.java:91)
at
org.eclipse.core.internal.preferences.PreferencesService.<init>(Preferen
cesService.java:170)
at
org.eclipse.core.internal.preferences.PreferencesService.getDefault(Pref
erencesService.java:83)
at
org.eclipse.core.internal.preferences.Activator.registerServices(Activat
or.java:74)
at
org.eclipse.core.internal.preferences.Activator.addingService(Activator.
java:80)
at
org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.
java:1011)
at
org.osgi.util.tracker.ServiceTracker$Tracked.track(ServiceTracker.java:9
89)
at
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTrack
er.java:917)
at
org.eclipse.osgi.framework.internal.core.FilteredServiceListener.service
Changed(FilteredServiceListener.java:71)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent
(BundleContextImpl.java:1219)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventMana
ger.java:189)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchrono
us(ListenerQueue.java:141)
at
org.eclipse.osgi.framework.internal.core.Framework.publishServiceEventPr
ivileged(Framework.java:1530)
at
org.eclipse.osgi.framework.internal.core.Framework.publishServiceEvent(F
ramework.java:1505)
at
org.eclipse.osgi.framework.internal.core.ServiceRegistrationImpl.<init>(
ServiceRegistrationImpl.java:103)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.createService
Registration(BundleContextImpl.java:649)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerServi
ce(BundleContextImpl.java:601)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerServi
ce(BundleContextImpl.java:667)
at
org.eclipse.core.internal.registry.osgi.Activator.startRegistry(Activato
r.java:110)
at
org.eclipse.core.internal.registry.osgi.Activator.start(Activator.java:5
4)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ontextImpl.java:994)
at
java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(BundleContextImpl.java:988)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ontextImpl.java:969)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.java:316)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractB
undle.java:328)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framewor
k.java:1041)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles
(StartLevelManager.java:573)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(Start
LevelManager.java:495)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLev
el(StartLevelManager.java:275)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent
(StartLevelManager.java:455)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventMana
ger.java:189)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventMa
nager.java:291)
!ENTRY
org.eclipse.equinox.preferences 4 0 2006-02-01 16:14:39.704
!MESSAGE
FrameworkEvent.ERROR
!STACK 0
java.lang.NullPointerException
at
org.eclipse.core.internal.preferences.PreferencesService.getPrefExtensio
ns(PreferencesService.java:1134)
at
org.eclipse.core.internal.preferences.PreferencesService.initializeScope
s(PreferencesService.java:91)
at
org.eclipse.core.internal.preferences.PreferencesService.<init>(Preferen
cesService.java:170)
at
org.eclipse.core.internal.preferences.PreferencesService.getDefault(Pref
erencesService.java:83)
at
org.eclipse.core.internal.preferences.Activator.registerServices(Activat
or.java:74)
at
org.eclipse.core.internal.preferences.Activator.addingService(Activator.
java:80)
at
org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.
java:1011)
at
org.osgi.util.tracker.ServiceTracker$Tracked.track(ServiceTracker.java:9
89)
at
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTrack
er.java:917)
at
org.eclipse.osgi.framework.internal.core.FilteredServiceListener.service
Changed(FilteredServiceListener.java:71)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent
(BundleContextImpl.java:1219)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventMana
ger.java:189)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchrono
us(ListenerQueue.java:141)
at
org.eclipse.osgi.framework.internal.core.Framework.publishServiceEventPr
ivileged(Framework.java:1530)
at
org.eclipse.osgi.framework.internal.core.Framework.publishServiceEvent(F
ramework.java:1505)
at
org.eclipse.osgi.framework.internal.core.ServiceRegistrationImpl.<init>(
ServiceRegistrationImpl.java:103)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.createService
Registration(BundleContextImpl.java:649)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerServi
ce(BundleContextImpl.java:601)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerServi
ce(BundleContextImpl.java:667)
at
org.eclipse.core.internal.registry.osgi.Activator.startRegistry(Activato
r.java:110)
at
org.eclipse.core.internal.registry.osgi.Activator.start(Activator.java:5
4)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleC
ontextImpl.java:994)
at
java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivato
r(BundleContextImpl.java:988)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleC
ontextImpl.java:969)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHo
st.java:316)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractB
undle.java:328)
at
org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framewor
k.java:1041)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles
(StartLevelManager.java:573)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(Start
LevelManager.java:495)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLev
el(StartLevelManager.java:275)
at
org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent
(StartLevelManager.java:455)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventMana
ger.java:189)
at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventMa
nager.java:291)
_______________________________________________
equinox-dev
mailing
list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev
mailing
list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing
list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev