فهرست منبع

Disabled java util logging altogether.

From what I've tried and what I've read, it seems you can't reliably change the log level for loggers programmatically.  You can kind of get it to work, but then you see unexpected behavior.  I've seen many posts recommend disabling java util logging, or using one of the many bridges (such as the slf4j bridge) to replace the functionality provided by java.util.logging.
James Albright 9 سال پیش
والد
کامیت
4d6ca2870d
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      src/main/java/password/pwm/util/logging/PwmLogManager.java

+ 4 - 3
src/main/java/password/pwm/util/logging/PwmLogManager.java

@@ -23,8 +23,10 @@
 package password.pwm.util.logging;
 
 import com.novell.ldapchai.ChaiUser;
+
 import org.apache.log4j.*;
 import org.apache.log4j.xml.DOMConfigurator;
+
 import password.pwm.AppProperty;
 import password.pwm.PwmApplication;
 import password.pwm.PwmConstants;
@@ -95,9 +97,8 @@ public class PwmLogManager {
 
         initFileLogger(config, fileLogLevel, pwmApplicationPath);
 
-        // disable jersey warnings.
-        java.util.logging.LogManager.getLogManager().addLogger(java.util.logging.Logger.getLogger("com.sun.jersey.spi.container.servlet.WebComponent"));
-        java.util.logging.LogManager.getLogManager().getLogger("com.sun.jersey.spi.container.servlet.WebComponent").setLevel(java.util.logging.Level.OFF);
+        // disable java's logging altogether, since you can't seem to change the log level for Jersey programmatically, and have it stick.
+        java.util.logging.LogManager.getLogManager().reset();
     }
 
     private static void initConsoleLogger(