[logback-dev] svn commit: r993 - logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Nov 22 23:17:37 CET 2006


Author: ceki
Date: Wed Nov 22 23:17:37 2006
New Revision: 993

Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java

Log:
minor changes

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java	Wed Nov 22 23:17:37 2006
@@ -14,6 +14,8 @@
   long total = 0;
   final StatisticalViewImpl accessStatsImpl;
   
+  String domain = "ch.qos.logback.access";
+  
   public CountingFilter() {
     accessStatsImpl = new StatisticalViewImpl(this);
   }
@@ -21,6 +23,7 @@
   @Override
   public FilterReply decide(Object event) {
     total++;
+    accessStatsImpl.update();
     return FilterReply.NEUTRAL;
   }
 
@@ -33,7 +36,7 @@
   public void start() {
     MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
     try {
-      ObjectName on = new ObjectName("totp:Filter=1");
+      ObjectName on = new ObjectName(domain+":Name="+getName());
       StandardMBean mbean = new StandardMBean(accessStatsImpl, StatisticalView.class);
       mbs.registerMBean(mbean, on);
       super.start();
@@ -53,5 +56,13 @@
       addError("Failed to unregister mbean", e);
     }
   }
+
+  public String getDomain() {
+    return domain;
+  }
+
+  public void setDomain(String domain) {
+    this.domain = domain;
+  }
   
 }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java	Wed Nov 22 23:17:37 2006
@@ -45,7 +45,7 @@
     return statsByWeek.getLastCount();
   }
 
-  void refresh(long now) {
+  void update(long now) {
     long total = getTotal();
     statsByMinute.update(now, total);
     statsByHour.update(now, total);
@@ -55,12 +55,13 @@
     
   }
 
-  void refresh() {
+  void update() {
     long now = System.currentTimeMillis();
-    refresh(now);
+    update(now);
   }
 
   public void start() {
+    System.out.println("StatisticalViewImpl start called");
     started = true;
     long now = System.currentTimeMillis();
     statsByMinute = new StatsByMinute(now);



More information about the logback-dev mailing list