3 Replies Latest reply on Apr 19, 2005 10:54 AM by Dimitris Andreadis

    Service Binding Manager and Log4jService

    Andy Nguyen Newbie

      This may sound wierd, but I want to use the ServiceBindingManager to modify the log4j.xml used by the Log4jService. I've enabled the SBM and modified my bindings.xml file to include an XSLTFileDelegate for jboss.system:type=Log4jService,service=Logging. This delegate probably won't work for the ConfigurationURL attribute on Log4jService, but I just wanted to see what would happen.

      It looks like my bindings are not being applied. I placed a breakpoint in the XSLTFileDelegate, and it's never called for the Log4jService. Is there a limitation on what services can be manipulated with Service Binding Manager? Are jboss.system services excluded?

        • 1. Re: Service Binding Manager and Log4jService
          Dimitris Andreadis Master

          I am not sure if this is related to the order the BindingManager appears in conf/jboss-service.xml, i.e. after Log4jService. Try to put it first.

          Another thing you can try is to use a JVM property, e.g.

          ./run -Dmy.log4j.config=....

          and then

           <mbean code="org.jboss.logging.Log4jService"
           <attribute name="ConfigurationURL">${my.log4j.config}</attribute>

          • 2. Re: Service Binding Manager and Log4jService
            Andy Nguyen Newbie

            Dimitris, you're a genius!

            Changing the order worked, but as I expected, the XSLTFileDelegate didn't work. I'm gonna try my hand at implementing XSLTURLDelegate. Should be very similar to the file delegate.

            It's unfortunate that the binding delegates aren't setup well to be extended. They provide no hooks for subclasses to alter small pieces of functionality. It seems a basic abstract delegate should be provided to share functionality as well as offer subclasses a way to handle specific parameter types.

            For example, XSLTConfigDelegate allows for arbitrary parameter bindings into the transformation. XSLTFileDelegate only allows parameter bindings for "host" and "port". IMO, that functionality should be refactored into a base class.

            If there's interest, I would be willing to do the refactoring and submit the code.

            • 3. Re: Service Binding Manager and Log4jService
              Dimitris Andreadis Master

              If you can refactor it to make it more extensible, without breaking the existing bindings, that would be great.

              Register that in JIRA as a feature request and submit the patch there.