Commit 34b4b822 authored by Jörg Richter's avatar Jörg Richter

Improve server log (#389)

parent 79b449ee
Pipeline #10498 passed with stages
in 8 minutes and 40 seconds
......@@ -377,6 +377,8 @@ public class PluginImpl implements Plugin, EventHandler {
// ---
// compare to CoreActivator.createServiceTracker()
// compare to handleEvent()
private ServiceTracker createServiceTracker(final Class serviceInterface) {
//
return new ServiceTracker(bundleContext, serviceInterface.getName(), null) {
......@@ -387,11 +389,11 @@ public class PluginImpl implements Plugin, EventHandler {
try {
service = super.addingService(serviceRef);
addService(service, serviceInterface);
checkRequirementsForActivation();
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while adding service " + serviceInterface.getName() +
" to " + pluginContext + ":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
logger.log(Level.SEVERE, "", e);
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
return service;
}
......@@ -402,10 +404,9 @@ public class PluginImpl implements Plugin, EventHandler {
removeService(service, serviceInterface);
super.removedService(ref, service);
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while removing service " + serviceInterface.getName() +
" from " + pluginContext + ":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
logger.log(Level.SEVERE, "", e);
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
}
};
......@@ -433,16 +434,13 @@ public class PluginImpl implements Plugin, EventHandler {
setCoreService((CoreServiceImpl) service);
publishWebResources();
publishRestResources();
checkRequirementsForActivation();
} else if (service instanceof EventAdmin) {
logger.info("Adding Event Admin service to " + this);
eventService = (EventAdmin) service;
checkRequirementsForActivation();
} else {
logger.info("Adding " + serviceInterface.getName() + " to " + this);
injectableServices.get(serviceInterface).injectService(service);
pluginContext.serviceArrived(service);
checkRequirementsForActivation();
}
}
......@@ -938,13 +936,11 @@ public class PluginImpl implements Plugin, EventHandler {
return;
}
//
logger.info("Handling PLUGIN_ACTIVATED event from \"" + pluginUri + "\" for " + this);
checkRequirementsForActivation();
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while handling PLUGIN_ACTIVATED event from \"" + pluginUri +
"\" for " + this + ":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
logger.log(Level.SEVERE, "", e);
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
}
......
......@@ -67,8 +67,8 @@ public class CoreActivator implements BundleActivator {
(httpServiceTracker = createServiceTracker(HttpService.class)).open();
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while starting \"DMX Core\":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
// File Install would retry to start the bundle endlessly.
}
}
......@@ -90,8 +90,8 @@ public class CoreActivator implements BundleActivator {
}
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while stopping \"DMX Core\":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
}
......@@ -140,6 +140,7 @@ public class CoreActivator implements BundleActivator {
// ------------------------------------------------------------------------------------------------- Private Methods
// compare to PluginImpl.createServiceTracker()
private ServiceTracker createServiceTracker(final Class serviceInterface) {
//
return new ServiceTracker(bundleContext, serviceInterface.getName(), null) {
......@@ -151,10 +152,9 @@ public class CoreActivator implements BundleActivator {
service = super.addingService(serviceRef);
addService(service);
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while adding service " + serviceInterface.getName() +
" to \"DMX Core\":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
logger.log(Level.SEVERE, "", e);
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
return service;
}
......@@ -165,10 +165,9 @@ public class CoreActivator implements BundleActivator {
removeService(service);
super.removedService(ref, service);
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while removing service " + serviceInterface.getName() +
" from \"DMX Core\":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
logger.log(Level.SEVERE, "", e);
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
}
};
......
......@@ -56,8 +56,8 @@ public class PluginActivator implements BundleActivator, PluginContext {
plugin.start();
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while starting " + this + ":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
// File Install would retry to start the bundle endlessly.
}
}
......@@ -74,8 +74,8 @@ public class PluginActivator implements BundleActivator, PluginContext {
plugin.stop();
} catch (Throwable e) {
logger.log(Level.SEVERE, "An error occurred while stopping " + this + ":", e);
// Note: here we catch anything, also errors (like NoClassDefFoundError).
// If thrown against OSGi container it would not print out the stacktrace.
// Note: we catch anything, also errors (like NoClassDefFoundError).
// Anything thrown from here would be swallowed by OSGi container.
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment