title: Wildfly java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoader when using custom logging formatter
body: <p>I am using the default jboss-logging (LogManager) in Wildfly 10 and am attempting to create my own logging formatter.</p>
  
  <p>I am configuring it like this in the standalone.xml:</p>
  
  <pre><code>    &lt;subsystem xmlns="urn:jboss:domain:logging:3.0"&gt;
          &lt;use-deployment-logging-config value="false"/&gt;
          &lt;console-handler name="CONSOLE"&gt;
              &lt;level name="INFO"/&gt;
              &lt;formatter&gt;
                  &lt;named-formatter name="JSON_PATTERN"/&gt;
              &lt;/formatter&gt;
          &lt;/console-handler&gt;
          &lt;formatter name="JSON_PATTERN"&gt;
              &lt;custom-formatter
                      class="com.mycompany.JsonLogFormatter"
                      module="com.mycompany.logging"/&gt;
          &lt;/formatter&gt;
      &lt;/subsystem&gt;
  </code></pre>
  
  <p>I created a jboss module like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module xmlns="urn:jboss:module:1.3" name="com.mycompany.logging"&gt;
      &lt;resources&gt;
          &lt;resource-root path="log-utils-1.0.0.jar" /&gt;
      &lt;/resources&gt;
      &lt;dependencies&gt;
          &lt;module name="javax.json.api"/&gt;
          &lt;module name="org.jboss.logmanager" /&gt;
          &lt;module name="org.jboss.logging" /&gt;
          &lt;module name="org.jboss.modules"/&gt;
      &lt;/dependencies&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p>where the log-utils-1.0.0.jar contains my JsonLogFormatter class and is located in the same directory as the module.xml (located in $JBOSS_HOME/modules/com/mycompany/logging/main)</p>
  
  <p>When firing up the wildfly container, it fails to start and I am seeing this exception: </p>
  
  <pre><code>java.lang.IllegalArgumentException: Failed to load module "com.mycompany.logging" for formatter "JSON_PATTERN"
      at org.jboss.logmanager.config.AbstractPropertyConfiguration.&lt;init&gt;(AbstractPropertyConfiguration.java:64) [jboss-logmanager-2.0.4.Final.jar:2.0.4.Final]
      at org.jboss.logmanager.config.FormatterConfigurationImpl.&lt;init&gt;(FormatterConfigurationImpl.java:30) [jboss-logmanager-2.0.4.Final.jar:2.0.4.Final]
      at org.jboss.logmanager.config.LogContextConfigurationImpl.addFormatterConfiguration(LogContextConfigurationImpl.java:171) [jboss-logmanager-2.0.4.Final.jar:2.0.4.Final]
      at org.jboss.as.logging.logmanager.ConfigurationPersistence.addFormatterConfiguration(ConfigurationPersistence.java:218)
      at org.jboss.as.logging.CustomFormatterResourceDefinition$2.performRuntime(CustomFormatterResourceDefinition.java:117)
      at org.jboss.as.logging.LoggingOperations$LoggingAddOperationStepHandler$1.execute(LoggingOperations.java:204)
      at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:890) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:659) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1329) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:493) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:387) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:349) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.server.ServerService.boot(ServerService.java:397) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.server.ServerService.boot(ServerService.java:366) [wildfly-server-2.2.0.Final.jar:2.2.0.Final]
      at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299) [wildfly-controller-2.2.0.Final.jar:2.2.0.Final]
      at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
   Caused by: java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoader
      at org.jboss.logmanager.config.AbstractPropertyConfiguration$ModuleFinder.getClassLoader(AbstractPropertyConfiguration.java:463) [jboss-logmanager-2.0.4.Final.jar:2.0.4.Final]
      at org.jboss.logmanager.config.AbstractPropertyConfiguration.&lt;init&gt;(AbstractPropertyConfiguration.java:62) [jboss-logmanager-2.0.4.Final.jar:2.0.4.Final]
      ... 16 more
  </code></pre>