mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
improve logging for loading of plugins
This commit is contained in:
@@ -119,6 +119,12 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
|
||||
for (Plugin plugin : installedPlugins)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("search extensions from plugin {}",
|
||||
plugin.getInformation().getId());
|
||||
}
|
||||
|
||||
InputStream input = null;
|
||||
|
||||
try
|
||||
@@ -136,6 +142,17 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
|
||||
if (pluginFile.exists())
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
String type = pluginFile.isDirectory()
|
||||
? "directory"
|
||||
: "jar";
|
||||
|
||||
logger.trace("search extensions in packages {} of {} plugin {}",
|
||||
new Object[] { extensions,
|
||||
type, pluginFile });
|
||||
}
|
||||
|
||||
if (pluginFile.isDirectory())
|
||||
{
|
||||
scanner.processExtensions(classLoader, extensions, pluginFile,
|
||||
@@ -163,8 +180,18 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
}
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("start processing {} extensions", extensions.size());
|
||||
}
|
||||
|
||||
for (ExtensionObject exo : extensions)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("process extension {}", exo.getExtensionClass());
|
||||
}
|
||||
|
||||
processor.processExtension(exo.getExtension(), exo.getExtensionClass());
|
||||
}
|
||||
}
|
||||
@@ -205,9 +232,14 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error(ex.getMessage(), ex);
|
||||
logger.error("could not decode path ".concat(path), ex);
|
||||
}
|
||||
}
|
||||
else if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(
|
||||
"{} seems not to be a file path or the file does not exists", path);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -232,6 +264,15 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
|
||||
loadPlugin(url);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("loaded {} plugins", installedPlugins.size());
|
||||
}
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("no plugin descriptor found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +286,11 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
{
|
||||
String path = url.toExternalForm();
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("try to load plugin from {}", path);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (path.startsWith("file:"))
|
||||
@@ -265,9 +311,9 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("load {}plugin {}", corePlugin
|
||||
? "core "
|
||||
: " ", path);
|
||||
logger.info("load {} plugin {}", corePlugin
|
||||
? "core "
|
||||
: " ", path);
|
||||
}
|
||||
|
||||
Plugin plugin = JAXB.unmarshal(url, Plugin.class);
|
||||
@@ -287,6 +333,12 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
}
|
||||
|
||||
plugin.setPath(path);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("add plugin {} to installed plugins", info.getId());
|
||||
}
|
||||
|
||||
installedPlugins.add(plugin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -298,7 +350,7 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
* TODO create util method
|
||||
*
|
||||
*
|
||||
* @return
|
||||
@@ -309,6 +361,11 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
|
||||
if (classLoader == null)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("could not use context classloader, try to use default");
|
||||
}
|
||||
|
||||
classLoader = DefaultPluginManager.class.getClassLoader();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user