All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.qos.logback.classic.joran.action.LevelAction Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4

There is a newer version: 2.12.15
Show newest version
/**
 * Logback: the reliable, generic, fast and flexible logging framework.
 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
 *
 * This program and the accompanying materials are dual-licensed under
 * either the terms of the Eclipse Public License v1.0 as published by
 * the Eclipse Foundation
 *
 *   or (per the licensee's choosing)
 *
 * under the terms of the GNU Lesser General Public License version 2.1
 * as published by the Free Software Foundation.
 */
package ch.qos.logback.classic.joran.action;

import org.xml.sax.Attributes;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.core.joran.action.Action;
import ch.qos.logback.core.joran.action.ActionConst;
import ch.qos.logback.core.joran.spi.InterpretationContext;

/**
 * Action to handle the  element nested within  element. 
 * 
 * 

This action is deprecated. Use the level attribute within the logger * element. * * @author Ceki Gulcu */ public class LevelAction extends Action { boolean inError = false; public void begin(InterpretationContext ec, String name, Attributes attributes) { Object o = ec.peekObject(); if (!(o instanceof Logger)) { inError = true; addError("For element , could not find a logger at the top of execution stack."); return; } Logger l = (Logger) o; String loggerName = l.getName(); String levelStr = ec.subst(attributes.getValue(ActionConst.VALUE_ATTR)); // addInfo("Encapsulating logger name is [" + loggerName // + "], level value is [" + levelStr + "]."); if (ActionConst.INHERITED.equalsIgnoreCase(levelStr) || ActionConst.NULL.equalsIgnoreCase(levelStr)) { l.setLevel(null); } else { l.setLevel(Level.toLevel(levelStr, Level.DEBUG)); } addInfo(loggerName + " level set to " + l.getLevel()); } public void finish(InterpretationContext ec) { } public void end(InterpretationContext ec, String e) { } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy