Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Logging the PluginsManager initialization



This article explains how to log the initialization process of the PluginsManager. This can be useful if for some reason one of your Plugins is not showing in the application.

Enabling the logging

To enable the logging, you must call one of the following methods: These methods must be called after calling AbstractApplication.initConfiguration(Preferences pref) and before AbstractApplication.registerPlugins().

For example:
   public class ActionsTutorialMDI extends AbstractMDIApplication {
      public ActionsTutorialMDI() {
        super("ActionsTutorialMDI");
        pluginsDir = new File(System.getProperty("user.dir")); // plugins directory
      
        this.initConfiguration();
        pluginsManager.logRegisterProgress(true);
        this.registerPlugins();
      }
   }

Specifying the logging progress type

The PluginsManager.logRegisterProgress(char logProgress) method allows to specify precisely how the Plugins initialization process is loggged: For example:
   public class ActionsTutorialMDI extends AbstractMDIApplication {
      public ActionsTutorialMDI() {
        super("ActionsTutorialMDI");
        pluginsDir = new File(System.getProperty("user.dir")); // plugins directory
      
        this.initConfiguration();
        pluginsManager.logRegisterProgress(PluginsManager.LOG_FULL);
        this.registerPlugins();
      }
   }

Logging result

The logging is shown on the console. Errors will show on the error stream.

Valid result

In that case, everything works fine:
      === Register Plugins ===
      == Load Plugins ==
      === Parse Plugins Manifests ===
      Try to parse Manifest for Plugin /C:/Java/mdiframework/samples/dist/actions/ActionsTutorialPlugin1.jar... Done
      Try to parse Manifest for Plugin /C:/Java/mdiframework/samples/dist/actions/ActionsTutorialPlugin2.jar... Done
  
      == Load Plugin Classes ==
      Try to get Plugin Class for org.actionstutorial.plugins.plugin2.OpenDocumentPlugin... Done
      Try to get Plugin Class for org.actionstutorial.plugins.plugin1.OpenImagePlugin... Done
  
      == Register Plugins ==
      Try to call Plugin.register for Plugin OpenDocuments... Done
      Try to call Plugin.register for Plugin OpenImages... Done
  
      === Init Plugins ===
      == Load Plugins resources ==
      Try to load resources for Plugin OpenDocuments... Done
      Try to load resources for Plugin OpenImages... Done
      == Initialize Plugins ==
      Try to initialize Plugin OpenDocuments... Done
      Try to initialize Plugin OpenImages... Done
  
      === Initialize Plugins after GUI creation ===
      === Reset Plugins settings ===
      Try to reset settings for Plugin OpenDocuments... Done
      Try to reset settings for Plugin OpenImages... Done

Invalid result

In that case, the Classpath of one of the Plugins is incorrect:
      === Register Plugins ===
      == Load Plugins ==
      === Parse Plugins Manifests ===
      Try to parse Manifest for Plugin /C:/Java/mdiframework/samples/dist/actions/ActionsTutorialPlugin1.jar... Done
      Try to parse Manifest for Plugin /C:/Java/mdiframework/samples/dist/actions/ActionsTutorialPlugin2.jar... Done
  
      == Load Plugin Classes ==
      Try to get Plugin Class for org.actionstutorial.plugins.plugin2.OpenDocumentPlugin... Done
      Unable to find Plugin org.actionstutorial.plugins.plugin1.OpenImagePlugin2, thrown java.lang.ClassNotFoundException
               org.actionstutorial.plugins.plugin1.OpenImagePlugin2
      Try to get Plugin Class for org.actionstutorial.plugins.plugin1.OpenImagePlugin2... 
      Unable to find org.actionstutorial.plugins.plugin1.OpenImagePlugin2 plugin
               (org.actionstutorial.plugins.plugin1.OpenImagePlugin2)
      == Register Plugins ==
      Try to call Plugin.register for Plugin OpenDocuments... Done
  
      === Init Plugins ===
      == Load Plugins resources ==
      Try to load resources for Plugin OpenDocuments... Done
      == Initialize Plugins ==
      Try to initialize Plugin OpenDocuments... Done
  
      === Initialize Plugins after GUI creation ===
      === Reset Plugins settings ===
      Try to reset settings for Plugin OpenDocuments... Done

See also


Categories: Plugins

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences