4 Replies Latest reply on Feb 27, 2017 12:29 PM by daled

    WildFly 10 slf4j binding

    daled

      I am trying to make sure that I understand the default binding associated with slf4j for WildFly 10.

       

      We are using slf4j for logging within our java code.  Within the pom.xml file we specify the slf4f-api with compile scope.  There are no slf4j bindings specified in the pom.xml file.

       

      The default logging settings are in place (e.g. add-logging-api-dependencies and use-dependent-logging-config are both true), and no deployment specific logging configuration files are in use.

       

      I assume that WildFly is using the slf4j implementation for logging?  Is the binding "slf4j-jboss-logmanager"?  Or do we need to specify the binding somewhere?

        • 1. Re: WildFly 10 slf4j binding
          jamezp

          You shouldn't need to specify the binding at all. It should automatically be added to your deployment. Are you not seeing logged messages?

           

          --

          James R. Perkins

          • 2. Re: WildFly 10 slf4j binding
            daled

            I'm not in troubleshoot mode.  I'm in understand mode.

             

            I'm trying to confirm two assumptions:

            1.  The scope for slf4j-api should be "provided".  Simply referencing an slf4j logger within the java code will cause WildFly logging to use the slf4j api.

            2.  The default slf4j binding for WildFly is slf4j-jboss-logmanager.  If there is a desire to use a different binding, the binding must be set to "compile" scope.  Would this override the default slf4j-jboss-logmanager binding?

             

            Thanks.

            • 3. Re: WildFly 10 slf4j binding
              jamezp

              1. The scope for slf4j-api should be "provided".  Simply referencing an slf4j logger within the java code will cause WildFly logging will use the slf4j api.

              Correct. WildFly will automatically add the org.slf4j module dependency to your deployment.

              2. The default slf4j binding for WildFly is slf4j-jboss-logmanager.  If there is a desire to use a different binding, the binding must be set to "compile" scope.  Would this override the default slf4j-jboss-logmanager binding?

              Yes the default binding is the slf4j-jboss-logmanager. However if you want to use a different binding you need to exclude the org.slf4j module from being added to your deployment, include the slf4j-api in your deployment along with the desired binding. There are several ways to exclude the org.slf4j module, but the easiest is just to use a jboss-deployment-structure.xml and exclude the logging subsystem.

               

              --

              James R. Perkins

              • 4. Re: WildFly 10 slf4j binding
                daled

                Awesome.  Thanks.