When Elasticsearch starts up, plugins are loaded based on their inter-dependencies. The specific order used is sometimes useful to see. Currently though the actual order cannot be seen. Instead the modules and plugins are logged in name sorted order after all loading has occurred.

We should be more clear about what order the plugins are actually loaded in, though we do need to be careful as to not add too much noise. I suggest moving the "loaded xxx module" message to the actual loading method in PluginsService (it will require passing through whether the code being loaded is a module or plugin).


server/src/main/java/org/elasticsearch/plugins/PluginsService.java
private static void ensureEntryPointAccessible(Controller controller, Module pluginModule, String className) {
        if (className != null) {
            controller.addOpens(pluginModule, toPackageName(className), serverModule);
        }
    }
    /**
     * Adds qualified exports declared in the server module descriptor to the target module.
     * This is required since qualified exports targeting yet-to-be-created modules, i.e. plugins,
     * are silently dropped when the boot layer is created.
     */
    private static void addQualifiedExports(Module target) {
        serverModule.getDescriptor()
            .exports()
            .stream()
            .filter(ModuleDescriptor.Exports::isQualified)
            .filter(exports -> exports.targets().contains(target.getName()))
            .forEach(exports -> serverModule.addExports(exports.source(), target));
    }
    /**
     * Adds qualified opens declared in the server module descriptor to the target module.
     * This is required since qualified opens targeting yet-to-be-created modules, i.e. plugins,
     * are silently dropped when the boot layer is created.
     */
    private static void addQualifiedOpens(Module target) {
        serverModule.getDescriptor()
            .opens()
            .stream()
            .filter(ModuleDescriptor.Opens::isQualified)
            .filter(opens -> opens.targets().contains(target.getName()))
            .forEach(opens -> serverModule.addExports(opens.source(), target));