How to debug module loading in WildFly

In this tutorial you will learn how to debug the list of WildFly modules loaded at boot. In order to do that, you need to increase the level of logging on the namespace “org.jboss.modules” so that it will log information about a particular class being loaded and the module from which it comes.

/subsystem=logging/logger=org.jboss.modules:add(level=TRACE)

 Now if you check the server.log file you will see that, every class found in the modules will be printed. Here is a small excerpt of the logs:

2018-12-11 19:09:55,439 TRACE [org.jboss.modules] (management-handler-thread - 1) Finding class java.util.LinkedHashSet from Module "org.jboss.as.logging" version 6.0.2.Final from local module loader @3fb6a447 (finder: local module finder @79b4d0f (roots: /home/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules,/home/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules/system/layers/base))
2018-12-11 19:09:55,444 TRACE [org.jboss.modules] (management-handler-thread - 1) Finding class org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource from Module "org.jboss.as.controller" version 6.0.2.Final from local module loader @3fb6a447 (finder: local module finder @79b4d0f (roots: /home/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules,/home/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules/system/layers/base))
2018-12-11 19:09:55,445 TRACE [org.jboss.modules] (management-handler-thread - 1) Finding local class org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource from Module "org.jboss.as.controller" version 6.0.2.Final from local module loader @3fb6a447 (finder: local module finder @79b4d0f (roots: /home/francesco/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules,/home/jboss/wildfly-15.0.0.Alpha1-SNAPSHOT/modules/system/layers/base))

If you are running in Domain mode, just prepend the profile at the beginning:

/profile=full/subsystem=logging/logger=org.jboss.modules:add(level=TRACE)

Restart the server for the changes to take effect.