[logback-dev] svn commit: r1174 - logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx

noreply.seb at qos.ch noreply.seb at qos.ch
Mon Jan 8 21:41:46 CET 2007


Author: seb
Date: Mon Jan  8 21:41:46 2007
New Revision: 1174

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/jmx/Configurator.java

Log:
Corrected setLevel method

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	Mon Jan  8 21:41:46 2007
@@ -27,9 +27,12 @@
 
   public void reload(String fileName) throws JoranException {
     LoggerContext lc = (LoggerContext) context;
+    addInfo("Shutting down context: " + lc.getName());
+    lc.shutdownAndReset();
     JoranConfigurator configurator = new JoranConfigurator();
     configurator.setContext(lc);
     configurator.doConfigure(fileName);
+    addInfo("Context: " + lc.getName() + " reloaded.");
   }
 
   public void reload(URL url) throws JoranException {
@@ -41,7 +44,18 @@
   }
 
   public void setLoggerLevel(String loggerName, String levelStr) {
+    if (loggerName == null) {
+      return;
+    }
+    if (levelStr == null) {
+      return;
+    }
+    loggerName = loggerName.trim();
+    levelStr = levelStr.trim();
+    
+    addInfo("Trying to set level " + levelStr + " to logger " + loggerName);
     LoggerContext lc = (LoggerContext) context;
+    
     Logger logger = lc.getLogger(loggerName);
     if ("null".equalsIgnoreCase(levelStr)) {
       logger.setLevel(null);



More information about the logback-dev mailing list