[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Safe logging from a WeavingHook?

Hi,

When implementing a WeavingHook, is there a safe way to perform logging?

I'm asking because my current strategy recently broke when adding
the AERI error reporter to the mix:

I'm acquiring a log basically from
   Platform.getLog(bundleContext.getBundle())
(with extra caution to see if the platform is ready).

This works well until others register log listeners of their own.
Such breakage is tracked in https://bugs.eclipse.org/493566
showing a stack trace of what looks like deadly re-entrance,
causing NoClassDefFoundError.

I know that the Equinox framework uses a logger of its own,
which - I assume - does not support any log listeners, right?
Is it possible for a weaving hook implementation to log into
the framework log?

If no safe log is available, are there any points in the hook
protocol, where it is safe to log using a platform log?
I'm thinking of queueing log events until modified(WovenClass),
but even during that method I don't know if any class loading
is active further down the stack that may cause the same problem.
Do I have to maintain my own thread-local stack of classes
being defined to wait for a point when this stack is empty?
Or is it possible to get this information from the framework?

Interesting, how such a basic functionality like logging can blow
up a system, if both class loading and logging are extensible ...

thanks,
Stephan