log4j2如何根据配置的配置文件选取配置文件处理类的(ConfigurationFactory源码分析)
标签:plugin osgi serialized log listing
123456789101112131415161718192021222324252627282930313233343536373839 | <pre "1937793"
"blog_20161019_7_4786896"
= "java"
"code"
"5" >** * Locates all the plugins including search of specific packages. Warns about name collisions. * * @param
for
* @since
*/ public collectPlugins( final
final
final
new // First, iterate the Log4j2Plugin.dat files found in the main CLASSPATH Map<String, List<PluginType<?>>> builtInPlugins = PluginRegistry.getInstance().loadFromMainClassLoader(); if
// If we didn't find any plugins above, someone must have messed with the log4j-core.jar. // Search the standard package in the hopes we can find our core plugins. builtInPlugins = PluginRegistry.getInstance().loadFromPackage(LOG4J_PACKAGES); } mergeByName(newPlugins, builtInPlugins.get(categoryLowerCase)); // Next, iterate any Log4j2Plugin.dat files from OSGi Bundles for
final
mergeByName(newPlugins, pluginsByCategory.get(categoryLowerCase)); } // Next iterate any packages passed to the static addPackage method. for
final
mergeByName(newPlugins, PluginRegistry.getInstance().loadFromPackage(pkg).get(categoryLowerCase)); } // Finally iterate any packages provided in the configuration (note these can be changed at runtime). if
null ) { for
final
mergeByName(newPlugins, PluginRegistry.getInstance().loadFromPackage(pkg).get(categoryLowerCase)); } } LOGGER.debug( "PluginManager '{}' found {} plugins" , category, newPlugins.size()); plugins = newPlugins; }</pre>
|