1 2 Previous Next 17 Replies Latest reply on Jan 25, 2008 12:50 PM by vickyk

    ManagedConnectionFactory.setLogger

    amueller

      Hi,

      we are testing JBoss 4.0.5 with the SwiftMQ JCA RA. Everything works fine expect that JBoss sets a logger at the ManagedConnectionFactory. This produces huge log output for outbound messaging. I don't find any hint in the JBoss docs how to avoid setting the logger.

      Any hints?

      Thanks,
      Andreas Mueller
      (SwiftMQ)

        • 1. Re: ManagedConnectionFactory.setLogger
          vickyk

           

          "iit" wrote:

          Any hints?
          Thanks,
          Andreas Mueller
          (SwiftMQ)

          I see this code setting the logger on the ManagedConnectionFactory
          // Give it somewhere to tell people things
           String categoryName = poolingStrategy.getManagedConnectionFactory().getClass().getName() + "." + jndiName;
           Logger log = Logger.getLogger(categoryName);
           PrintWriter logWriter = new LoggerPluginWriter(log.getLoggerPlugin());
           try
           {
           poolingStrategy.getManagedConnectionFactory().setLogWriter(logWriter);
           }
           catch (ResourceException re)
           {
           log.warn("Unable to set log writer '" + logWriter + "' on " + "managed connection factory", re);
           log.warn("Linked exception:", re.getLinkedException());
           }
          

          It is from org.jboss.resource.connectionmanager.BaseConnectionManager2 .
          http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/org/jboss/resource/connectionmanager/BaseConnectionManager2.java
          Looks to me that you will need to implement a org.jboss.logging.LoggerPlugin interface for this . The implementation class should have the naming as defined here
          poolingStrategy.getManagedConnectionFactory().getClass().getName() + "." + jndiName


          Where is the huge log information getting populated right now , the default should be going in the server log ?



          • 2. Re: ManagedConnectionFactory.setLogger
            amueller

            How do I disable setting the logger at the MCF? If I cannot disable it then it's a bug in JBoss because once a logger has been set, the MCF logs everything like create/matchManagedConnection etc. That creates huge output in the server log.

            A standard JCA resource adapter does not need to implement any proprietary interfaces. It should work out of the box and the app server should provide the necessary instrumentation to set or unset a logger.

            Thanks,
            Andreas

            • 3. Re: ManagedConnectionFactory.setLogger
              vickyk

               

              "iit" wrote:
              If I cannot disable it then it's a bug in JBoss because once a logger has been set

              I don't see anything going against JCA specs here , this can be as the feature request .


              • 4. Re: ManagedConnectionFactory.setLogger
                amueller

                 

                "vickyk" wrote:
                "iit" wrote:
                If I cannot disable it then it's a bug in JBoss because once a logger has been set

                I don't see anything going against JCA specs here , this can be as the feature request .


                That's so typical JBoss'ish speech. You make a RA unusable by forcing it to produce huge log output and declare it as a feature request to remove that. That's so ignorant and impertinent, if you would tell that to one of my customers, you'd get fired before you'd end that sentence, be sure.

                It reminds me on this case:

                http://jira.jboss.com/jira/browse/JBAS-3343

                Someone from your famous JBoss developers forgot to implement to configure RA properties. The only way to get over this is to crack a rar file, configure the values as defaults and recreate the rar. This was also not considered as a bug but as a feature request. We are waiting for a fix since June 2006!

                The good thing is that there are viable alternatives to JBoss such as Glassfish which have a proven and working JCA implementation and very nice and responsive developers. It really doesn't matter whether you mark that as a bug or not. It only matters that it does not work. We all know that it takes months or even years until that get fixed. So we just move away from you.

                Cheers,
                Andreas

                • 5. Re: ManagedConnectionFactory.setLogger

                   

                  "iit" wrote:

                  Someone from your famous JBoss developers forgot to implement to configure RA properties. The only way to get over this is to crack a rar file, configure the values as defaults and recreate the rar. This was also not considered as a bug but as a feature request. We are waiting for a fix since June 2006!


                  Don't come here with a false sense of entitlement.
                  You want the feature implement it and contribute it back, it's open source.
                  I don't see anybody else providing the patch either so it can't be a high priority.

                  Anyway, the answer to this particular question is trivial.

                  1) You either throw a ResourceException to say you don't want the Logger.

                  2) You take your managed connection factory classname add "." + jndiname
                  and then go configure that to FATAL in conf/jboss-log4j.xml
                  Voila - no logging on that category.

                  • 6. Re: ManagedConnectionFactory.setLogger
                    amueller

                     

                    "adrian@jboss.org" wrote:
                    "iit" wrote:

                    Someone from your famous JBoss developers forgot to implement to configure RA properties. The only way to get over this is to crack a rar file, configure the values as defaults and recreate the rar. This was also not considered as a bug but as a feature request. We are waiting for a fix since June 2006!


                    Don't come here with a false sense of entitlement.


                    That's not false, that's the truth.

                    You want the feature implement it and contribute it back, it's open source.


                    JBoss is a commercial project and we don't work for less. Go, look for other idiots.

                    I don't see anybody else providing the patch either so it can't be a high priority.


                    I red several requests to fix that but nobody at JBoss cares since 2006.

                    Anyway, the answer to this particular question is trivial.


                    Trivial, stupid and arrogant.

                    1) You either throw a ResourceException to say you don't want the Logger.


                    That's a generic exception without any further description. JBoss might just continue but others, more quality app servers may mark the RA as errorneous and stop the whole thing.

                    2) You take your managed connection factory classname add "." + jndiname
                    and then go configure that to FATAL in conf/jboss-log4j.xml
                    Voila - no logging on that category.


                    Yeah, but the log output will still go to the logger.

                    What about admitting some bugs in your code instead of feeding the responsibility to others?


                    • 7. Re: ManagedConnectionFactory.setLogger
                      amueller

                      And, by the way, here is a snippet from the javadocs of http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/ManagedConnectionFactory.html#setLogWriter(java.io.PrintWriter)

                      When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

                      So if you set it, logging is enabled. And that's WRONG!

                      • 8. Re: ManagedConnectionFactory.setLogger

                         

                        "iit" wrote:
                        "adrian@jboss.org" wrote:
                        "iit" wrote:

                        Someone from your famous JBoss developers forgot to implement to configure RA properties. The only way to get over this is to crack a rar file, configure the values as defaults and recreate the rar. This was also not considered as a bug but as a feature request. We are waiting for a fix since June 2006!


                        Don't come here with a false sense of entitlement.


                        That's not false, that's the truth.


                        It's false because it is your problem. You (or your customer) downloaded
                        the software and chose to use it. If it doesn't do what you want then you can

                        1) Change it yourself
                        2) Pay somebody else to change it
                        3) Don't use it

                        What you can't do is complain that somebody has to meet your requirement for free
                        when they've almost certainly got more important things to work on.


                        You want the feature implement it and contribute it back, it's open source.


                        JBoss is a commercial project and we don't work for less. Go, look for other idiots.


                        JBoss is open source. RedHat doesn't sell it. We sell services on it.
                        Like make my favourite feature high priority please.
                        (P.S. That doesn't mean that won't do it immediately because
                        I wait for somebody to pay for it. I do - for free - what I think will most useful
                        to most people).


                        I don't see anybody else providing the patch either so it can't be a high priority.


                        I red several requests to fix that but nobody at JBoss cares since 2006.


                        Requests are not the same as implementing it. If people really care
                        then they provide a patch not a whine. Complaining that I don't
                        consider your problem a high priority just makes it more
                        likely that I don't want to help you.

                        Providing a patch (no matter how bad or incomplete) makes it a lot
                        more likely that I'll complete it propery because I don't have to start from scratch.


                        Anyway, the answer to this particular question is trivial.


                        Trivial, stupid and arrogant.


                        See comment below.


                        1) You either throw a ResourceException to say you don't want the Logger.


                        That's a generic exception without any further description. JBoss might just continue but others, more quality app servers may mark the RA as errorneous and stop the whole thing.


                        Fair point, but I've seen tonnes of resource adapters that do
                        throw new ResourceException("Not Implemented")
                        on that method. It's practically the default implementation (besides a no-op ;-)


                        2) You take your managed connection factory classname add "." + jndiname
                        and then go configure that to FATAL in conf/jboss-log4j.xml
                        Voila - no logging on that category.


                        Yeah, but the log output will still go to the logger.


                        Which will discard it using the usual log4j rules.


                        What about admitting some bugs in your code instead of feeding the responsibility to others?


                        There's plenty of bugs admitted, look at JIRA. This isn't one of them.

                        It's a bug when you can quote "chapter and verse" from the specs
                        or docs and say "look it doesn't work the way it says it supposed to".

                        If you want to make setLogger() configurable then provide a patch
                        to do so. Otherwise raise a feature request and wait for somebody to think
                        it is important.

                        Simple solution, and it doesn't involve calling people names.

                        • 9. Re: ManagedConnectionFactory.setLogger

                           

                          "iit" wrote:
                          And, by the way, here is a snippet from the javadocs of http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/ManagedConnectionFactory.html#setLogWriter(java.io.PrintWriter)

                          When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

                          So if you set it, logging is enabled. And that's WRONG!


                          And the bit you didn't quote...
                          which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

                          Which on JBoss is log4j configuration by default.

                          • 10. Re: ManagedConnectionFactory.setLogger

                             

                            "adrian@jboss.org" wrote:

                            Providing a patch (no matter how bad or incomplete) makes it a lot
                            more likely that I'll complete it propery because I don't have to start from scratch.


                            I'll even tell you how to do it (which I don't normally do until I've seen an initial attempt
                            because then it is more likely it gets contributed).

                            1) Add an MBean attribute to BaseConnectionManager2, e.g. is/setNoLogging()
                            and change the code above to be conditioned on that flag.
                            2) Change the xslt to match
                            <no-logging/>
                            and set the mbean confiig for that
                            attribute to true
                            3) For a proper job, update the dtd (although it isn't used to validate the xml)
                            and document it on the wiki


                            • 11. Re: ManagedConnectionFactory.setLogger
                              amueller

                               

                              "adrian@jboss.org" wrote:
                              "iit" wrote:
                              And, by the way, here is a snippet from the javadocs of http://java.sun.com/j2ee/1.4/docs/api/javax/resource/spi/ManagedConnectionFactory.html#setLogWriter(java.io.PrintWriter)

                              When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

                              So if you set it, logging is enabled. And that's WRONG!


                              And the bit you didn't quote...
                              which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

                              Which on JBoss is log4j configuration by default.


                              Which just shows that you don't read what you quote. Here is the complete sentence:

                              The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

                              To clearify it for you: It means that if you set a log writer at the ManagedConnectionFactory, it will be passed from the factory to the ManagedConnection instance (= the instance inherits it from the factory). It is possible, however, that the app server overwrites the log writer at the ManagedConnection.

                              It has nothing to do with the fact that it is a bug to set a log writer.

                              And thanks that you've clearified your business model to me. You introduce bugs and want that users pay to fix it. Nice.

                              And yes, we will try to convince our customers to get out of JBoss. Bye.

                              • 12. Re: ManagedConnectionFactory.setLogger

                                 

                                "iit" wrote:

                                Which on JBoss is log4j configuration by default.

                                Which just shows that you don't read what you quote. Here is the complete sentence:

                                The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.


                                Ok, I agree I misread it. But it's still not a bug.

                                Try this quote from getLogWriter

                                ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled.


                                i.e. There will be no logging unless the appserver associates an output stream
                                with MCF. If or how it does it is entirely down to it.

                                Since JBoss uses log4j and always associates a writer you can control
                                it using the log4j config.

                                Since JBoss is Open Source you change those rules, if you don't like it.
                                It's called a feature.

                                I fail to see how you can argue with a straight face that overridding a policy decision
                                can possibly be a bug?

                                • 13. Re: ManagedConnectionFactory.setLogger

                                   

                                  "iit" wrote:

                                  And thanks that you've clearified your business model to me. You introduce bugs and want that users pay to fix it. Nice.


                                  You know that using logical fallacies (especially when they are this obvious)
                                  just makes your argument look weaker to those that understand them.


                                  And yes, we will try to convince our customers to get out of JBoss. Bye.


                                  Ok. That's your perogative as I explained above.
                                  As with any software, if it doesn't do what you want. don't use it.

                                  Nobody is forcing you and since you didn't pay anything you haven't lost anything
                                  except possibly some "opportunity cost".

                                  • 14. Re: ManagedConnectionFactory.setLogger
                                    amueller

                                     

                                    "adrian@jboss.org" wrote:

                                    i.e. There will be no logging unless the appserver associates an output stream
                                    with MCF. If or how it does it is entirely down to it.

                                    Since JBoss uses log4j and always associates a writer you can control
                                    it using the log4j config.

                                    Since JBoss is Open Source you change those rules, if you don't like it.
                                    It's called a feature.

                                    I fail to see how you can argue with a straight face that overridding a policy decision
                                    can possibly be a bug?


                                    You don't want understand, right?

                                    To recap (from the javadoc): If you set a log writer, logging and tracing is ON! It doesn't matter if that is a null stream or not, because the MCF creates a huge debug/trace output.

                                    To use a RA with debug/trace enabled in a high-load scenario in production is not appropriate. In our case it's not usable.

                                    That is a bug.

                                    But anyway, bug or not, it doesn't work and that's what matters.



                                    1 2 Previous Next