public static void SetLogLevel(String strAppender, String level){ if(level == null || strAppender == null) return; Appender appender = Logger.getRootLogger().getAppender(strAppender); Level levelSet = Level.toLevel(level); if (levelSet != null && appender != null){ Filter filterIt = appender.getFilter(); while(filterIt != null){ if(filterIt instanceof LevelRangeFilter){ LevelRangeFilter f = (LevelRangeFilter)filterIt; f.setLevelMin(levelSet); break; } filterIt = filterIt.getNext(); } Logger.getRootLogger().setLevel(levelSet); } }
时间: 2024-10-19 01:17:45