Qpid
  1. Qpid
  2. QPID-4655

[Java Broker] add BrokerOptions support to request the Broker not perform log4j logging configuration when it is being run embedded

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.21
    • Component/s: Java Broker
    • Labels:
      None

      Description

      The broker configures Log4J at startup due to its heritage of running in a standalone VM. We have made the broker easier to run embedded in recent times, but it still always configures Log4J at startup. It was requested that we enable preventing it from doing this so the embedding application can configure things itself.

      Support will be added to the BrokerOptions object to allow requesting the Broker instance not perform log4j logging configuration when it is being run embedded. This will also prevent the brokers LoggingManagement MBean from being initialised, as it is dependant on the logging configuration perfomed by the broker and it also has direct support for managing the Log4j configuration file which may not exist in this case.

        Activity

        Robbie Gemmell created issue -
        Hide
        Robbie Gemmell added a comment -

        There are some log4j levels set by the broker which anyone using this functionality to skip the configuration should ensure to set themselves. Currently, these are:

            <logger additivity="true" name="org.apache.qpid">
                <level value="warn"/>
            </logger>
        
            <!-- Enable info messages for the status-logging hierarchy -->
            <logger additivity="true" name="qpid.message">
              <level value="info"/>
            </logger>
        
            <!-- Subscription state may toggle frequently for clients with low prefetch
            so switch off this operational logging by default-->
            <logger additivity="true" name="qpid.message.subscription.state">
              <level value="off"/>
            </logger>
        
            <!-- Enable log messages for the queue notifications -->
            <logger additivity="true" name="org.apache.qpid.server.queue.NotificationCheck">
              <level value="info"/>
            </logger>
        
            <!-- Set the commons logging that the XML parser uses to WARN, it is very chatty at debug -->
            <logger name="org.apache.commons">
                <level value="warn"/>
            </logger>
        
        Show
        Robbie Gemmell added a comment - There are some log4j levels set by the broker which anyone using this functionality to skip the configuration should ensure to set themselves. Currently, these are: <logger additivity="true" name="org.apache.qpid"> <level value="warn"/> </logger> <!-- Enable info messages for the status-logging hierarchy --> <logger additivity="true" name="qpid.message"> <level value="info"/> </logger> <!-- Subscription state may toggle frequently for clients with low prefetch so switch off this operational logging by default--> <logger additivity="true" name="qpid.message.subscription.state"> <level value="off"/> </logger> <!-- Enable log messages for the queue notifications --> <logger additivity="true" name="org.apache.qpid.server.queue.NotificationCheck"> <level value="info"/> </logger> <!-- Set the commons logging that the XML parser uses to WARN, it is very chatty at debug --> <logger name="org.apache.commons"> <level value="warn"/> </logger>
        Show
        Robbie Gemmell added a comment - Change made in http://svn.apache.org/viewvc?view=revision&revision=1457612
        Robbie Gemmell made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Robbie Gemmell made changes -
        Status In Progress [ 3 ] Ready To Review [ 10006 ]
        Hide
        Robbie Gemmell added a comment -

        Alex, could you review this change please?

        Thanks,
        Robbie

        Show
        Robbie Gemmell added a comment - Alex, could you review this change please? Thanks, Robbie
        Robbie Gemmell made changes -
        Assignee Robbie Gemmell [ gemmellr ] Alex Rudyy [ alex.rufous ]
        Hide
        Alex Rudyy added a comment -

        The changes look good for me. Changing JIRA to resolved state.

        The only thing I am wondering whether it makes sense to set flag for skipping log configuration to 'true' by default? So, anyone embedding the broker would not need to set it explicitly. However, I do not have strong opinion about it. What do you think Robbie?

        Show
        Alex Rudyy added a comment - The changes look good for me. Changing JIRA to resolved state. The only thing I am wondering whether it makes sense to set flag for skipping log configuration to 'true' by default? So, anyone embedding the broker would not need to set it explicitly. However, I do not have strong opinion about it. What do you think Robbie?
        Alex Rudyy made changes -
        Status Ready To Review [ 10006 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Robbie Gemmell added a comment -

        I did think about that but in the end decided leaving it the way it was by default would be better since it is probably going to annoy less people. Only one person has actually asked for this change, but we know a lot more people are already using it the way it was. Doing it this way, anyone that want the change in behaviour can request it and everyone else continues getting what they already did.

        Show
        Robbie Gemmell added a comment - I did think about that but in the end decided leaving it the way it was by default would be better since it is probably going to annoy less people. Only one person has actually asked for this change, but we know a lot more people are already using it the way it was. Doing it this way, anyone that want the change in behaviour can request it and everyone else continues getting what they already did.

          People

          • Assignee:
            Alex Rudyy
            Reporter:
            Robbie Gemmell
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development