@Override
 protected void processDeployment(
     final DeploymentPhaseContext phaseContext,
     final DeploymentUnit deploymentUnit,
     final ResourceRoot root)
     throws DeploymentUnitProcessingException {
   final List<DeploymentUnit> subDeployments = getSubDeployments(deploymentUnit);
   final String loggingProfile = findLoggingProfile(root);
   if (loggingProfile != null) {
     // Get the profile logging context
     final LoggingProfileContextSelector loggingProfileContext =
         LoggingProfileContextSelector.getInstance();
     if (loggingProfileContext.exists(loggingProfile)) {
       // Get the module
       final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
       final LogContext logContext = loggingProfileContext.get(loggingProfile);
       LoggingLogger.ROOT_LOGGER.tracef(
           "Registering log context '%s' on '%s' for profile '%s'",
           logContext, root, loggingProfile);
       registerLogContext(deploymentUnit, module, logContext);
       // Process sub-deployments
       for (DeploymentUnit subDeployment : subDeployments) {
         // A sub-deployment must have a module to process
         if (subDeployment.hasAttachment(Attachments.MODULE)) {
           // Set the result to true if a logging profile was found
           if (subDeployment.hasAttachment(Attachments.DEPLOYMENT_ROOT)) {
             processDeployment(
                 phaseContext,
                 subDeployment,
                 subDeployment.getAttachment(Attachments.DEPLOYMENT_ROOT));
           }
           if (!hasRegisteredLogContext(subDeployment)) {
             final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE);
             LoggingLogger.ROOT_LOGGER.tracef(
                 "Registering log context '%s' on '%s' for profile '%s'",
                 logContext,
                 subDeployment.getAttachment(Attachments.DEPLOYMENT_ROOT),
                 loggingProfile);
             registerLogContext(subDeployment, subDeploymentModule, logContext);
           }
         }
       }
     } else {
       LoggingLogger.ROOT_LOGGER.loggingProfileNotFound(loggingProfile, root);
     }
   } else {
     // No logging profile found, but the sub-deployments should be checked for logging profiles
     for (DeploymentUnit subDeployment : subDeployments) {
       // A sub-deployment must have a root resource and a module to process
       if (subDeployment.hasAttachment(Attachments.MODULE)
           && subDeployment.hasAttachment(Attachments.DEPLOYMENT_ROOT)) {
         processDeployment(
             phaseContext,
             subDeployment,
             subDeployment.getAttachment(Attachments.DEPLOYMENT_ROOT));
       }
     }
   }
 }