Fixed FELIX-2674 /Too much error logging after fixing FELIX-2644/
https://issues.apache.org/jira/browse/FELIX-2674
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1027104 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
index 48f1e6f..5fa2d79 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
@@ -728,6 +728,7 @@
final String pluginClassName;
final OsgiManager osgiManager;
AbstractWebConsolePlugin plugin;
+ boolean doLog = true;
protected InternalPlugin(PluginHolder holder, OsgiManager osgiManager, String pluginClassName, String label)
{
@@ -746,7 +747,11 @@
if (null == plugin) {
if (!isEnabled())
{
- osgiManager.log( LogService.LOG_INFO, "Ignoring plugin " + pluginClassName + ": Disabled by configuration" );
+ if (doLog)
+ {
+ osgiManager.log( LogService.LOG_INFO, "Ignoring plugin " + pluginClassName + ": Disabled by configuration" );
+ doLog = false;
+ }
return null;
}
@@ -759,11 +764,16 @@
{
((OsgiManagerPlugin) plugin).activate(getBundle().getBundleContext());
}
-
+ doLog = true; // reset logging if it succeeded
}
catch (Throwable t)
{
- osgiManager.log( LogService.LOG_WARNING, "Failed to instantiate plugin " + pluginClassName, t );
+ plugin = null; // in case only activate has faled!
+ if (doLog)
+ {
+ osgiManager.log( LogService.LOG_WARNING, "Failed to instantiate plugin " + pluginClassName, t );
+ doLog = false;
+ }
}
}