[logback-dev] svn commit: r1181 - in logback/trunk: . logback-classic logback-classic/src/main/java/ch/qos/logback/classic logback-classic/src/main/java/ch/qos/logback/classic/jmx logback-classic/src/main/java/ch/qos/logback/classic/spi
noreply.seb at qos.ch
noreply.seb at qos.ch
Tue Jan 9 21:03:33 CET 2007
Author: seb
Date: Tue Jan 9 21:03:33 2007
New Revision: 1181
Added:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java
Modified:
logback/trunk/logback-classic/pom.xml
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/Configurator.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/ConfiguratorMBean.java
logback/trunk/pom.xml
Log:
Added a getLoggerList method to the JMX Configurator
Modified: logback/trunk/logback-classic/pom.xml
==============================================================================
--- logback/trunk/logback-classic/pom.xml (original)
+++ logback/trunk/logback-classic/pom.xml Tue Jan 9 21:03:33 2007
@@ -62,7 +62,6 @@
<dependency>
<groupId>janino</groupId>
<artifactId>janino</artifactId>
- <version>2.4.3</version>
</dependency>
<dependency>
@@ -71,6 +70,11 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java Tue Jan 9 21:03:33 2007
@@ -11,6 +11,8 @@
package ch.qos.logback.classic;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
@@ -19,6 +21,7 @@
import org.slf4j.Marker;
import ch.qos.logback.classic.spi.ContextListener;
+import ch.qos.logback.classic.spi.LoggerComparator;
import ch.qos.logback.classic.spi.LoggerContextRemoteView;
import ch.qos.logback.classic.spi.TurboFilterAttachable;
import ch.qos.logback.classic.spi.TurboFilterAttachableImpl;
@@ -172,6 +175,13 @@
}
}
+ public List<Logger> getLoggerList() {
+ Collection<Logger> collection = loggerCache.values();
+ List<Logger> loggerList = new ArrayList<Logger>(collection);
+ Collections.sort(loggerList, new LoggerComparator());
+ return loggerList;
+ }
+
public LoggerContextRemoteView getLoggerContextRemoteView() {
return loggerContextRemoteView;
}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/Configurator.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/Configurator.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/Configurator.java Tue Jan 9 21:03:33 2007
@@ -1,6 +1,7 @@
package ch.qos.logback.classic.jmx;
import java.net.URL;
+import java.util.List;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
@@ -100,6 +101,11 @@
return EMPTY;
}
}
+
+ public List<Logger> getLoggerList() {
+ LoggerContext lc = (LoggerContext)context;
+ return lc.getLoggerList();
+ }
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/ConfiguratorMBean.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/ConfiguratorMBean.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/ConfiguratorMBean.java Tue Jan 9 21:03:33 2007
@@ -1,7 +1,9 @@
package ch.qos.logback.classic.jmx;
import java.net.URL;
+import java.util.List;
+import ch.qos.logback.classic.Logger;
import ch.qos.logback.core.joran.spi.JoranException;
public interface ConfiguratorMBean {
@@ -18,4 +20,5 @@
public String getLoggerEffectiveLevel(String loggerName);
+ public List<Logger> getLoggerList();
}
Added: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java Tue Jan 9 21:03:33 2007
@@ -0,0 +1,17 @@
+package ch.qos.logback.classic.spi;
+
+import java.util.Comparator;
+
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+
+public class LoggerComparator implements Comparator<Logger> {
+
+ public int compare(Logger l1, Logger l2) {
+ if (l1.getName().equals(LoggerContext.ROOT_NAME)) {
+ return -1;
+ }
+ return l1.getName().compareTo(l2.getName());
+ }
+
+}
Modified: logback/trunk/pom.xml
==============================================================================
--- logback/trunk/pom.xml (original)
+++ logback/trunk/pom.xml Tue Jan 9 21:03:33 2007
@@ -108,8 +108,12 @@
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
<version>6.0.0</version>
- </dependency>
-
+ </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>1.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
More information about the logback-dev
mailing list