Skip to content

Commit 1f93f64

Browse files
committed
PluginService: be less verbose if injection fails
If a plugin depends on an unavailable service, the context injection will fail. When a plugin fails to instantiate for whatever reason, we don't need to see the whole huge stack trace, normally. Let's reserve that for when debug mode is enabled. But still log the failure.
1 parent 3f13d99 commit 1f93f64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/scijava/plugin/DefaultPluginService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ public <PT extends SciJavaPlugin> List<PT> createInstances(
239239
return p;
240240
}
241241
catch (final Throwable t) {
242-
log.error("Cannot create plugin: " + info, t);
242+
final String errorMessage = "Cannot create plugin: " + info;
243+
if (log.isDebug()) log.debug(errorMessage, t);
244+
else log.error(errorMessage);
243245
}
244246
return null;
245247
}

0 commit comments

Comments
 (0)