記錄攔截器

功能 > 攔截器 > 記錄攔截器

記錄攔截器

記錄攔截器是一個非常簡單的攔截器,它只是將訊息在代理程式上發送或確認時,記錄到Jakarta Commons Logginglog4j

預設的記錄層級是 INFO。 如果您想增加/減少記錄,可以使用 commons logging 或 log4j 變更它

從 5.3 版本開始,記錄攔截器更加可配置。 其概念是記錄所有事件,但能夠透過設定關閉特定事件群組的記錄。

目前支援以下群組

屬性 描述 預設值
logAll 記錄所有事件 false
logConnectionEvents 與連線和會話相關的事件 true
logTransactionEvents 與交易處理相關的事件 false
logConsumerEvents 與消費訊息相關的事件 false
logProducerEvents 與生產訊息相關的事件 false
logInternalEvents 通常使用者不關心的事件,如故障轉移、查詢內部物件等 false
logSessionEvents 與新增和移除會話相關的事件 true

預設只啟用連線事件記錄。

您可以使用以下 XML 設定啟用記錄攔截器。 此範例啟用所有記錄並停用連線事件記錄

<beans 
  xmlns="http://www.springframework.org/schema/beans" 
  xmlns:amq="https://activemq.dev.org.tw/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  https://activemq.dev.org.tw/schema/core https://activemq.dev.org.tw/schema/core/activemq-core.xsd">
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  <broker useJmx="false" persistent="false" xmlns="https://activemq.dev.org.tw/schema/core">
    <plugins>
    
      <!-- lets enable detailed logging in the broker but ignore ConnectionEvents -->
      <loggingBrokerPlugin logAll="true" logConnectionEvents="false"/>
      
      <timeStampingBrokerPlugin zeroExpirationOverride="1000" ttlCeiling="60000" futureOnly="true"/>    
      <traceBrokerPathPlugin/>
      
    </plugins>
  </broker>
</beans>

Apache、ActiveMQ、Apache ActiveMQ、Apache 羽毛標誌和 Apache ActiveMQ 專案標誌是 Apache 軟體基金會的商標。 版權所有 © 2024,Apache 軟體基金會。 根據 Apache License 2.0 授權。