Beispiel #1
0
        public virtual void SetLoggerLevel(String loggerName, String levelName)
        {
            if (loggerName == null)
            {
                throw new NullPointerException("loggerName is null");
            }

            Logger logger = LogManager.GetLogger(loggerName);

            if (logger == null)
            {
                throw new IllegalArgumentException("Logger " + loggerName + "does not exist");
            }

            Level level = null;

            if (levelName != null)
            {
                // parse will throw IAE if logLevel is invalid
                level = Level.FindLevel(levelName);
                if (level == null)
                {
                    throw new IllegalArgumentException("Unknown level \"" + levelName + "\"");
                }
            }

            logger.Level = level;
        }
        public override Object ParseLevel(String levelName)
        {
            Level level = Level.FindLevel(levelName);

            if (level == null)
            {
                throw new IllegalArgumentException("Unknown level \"" + levelName + "\"");
            }
            return(level);
        }