[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.24-25-gb8b8a86

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Logback: the generic, reliable, fast and flexible logging framework.". The branch, master has been updated via b8b8a86ea7fb2a8a35751ebbdc0929633c784303 (commit) via c3c5476f1d20eca1a7d5681a1854a567880ee4d3 (commit) from f25fb2e781923f5569795de6828cebb911c9451b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=b8b8a86ea7fb2a8a35751ebbd... http://github.com/ceki/logback/commit/b8b8a86ea7fb2a8a35751ebbdc0929633c7843... commit b8b8a86ea7fb2a8a35751ebbdc0929633c784303 Merge: c3c5476 f25fb2e Author: Ceki Gulcu <ceki@qos.ch> Date: Tue Oct 12 22:22:52 2010 +0200 Merge branch 'master' of git.qos.ch:logback http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c3c5476f1d20eca1a7d5681a1... http://github.com/ceki/logback/commit/c3c5476f1d20eca1a7d5681a1854a567880ee4... commit c3c5476f1d20eca1a7d5681a1854a567880ee4d3 Author: Ceki Gulcu <ceki@qos.ch> Date: Tue Oct 12 22:22:10 2010 +0200 - adding the capability to listen to level changes diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java new file mode 100644 index 0000000..fe6890e --- /dev/null +++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java @@ -0,0 +1,80 @@ +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2009, 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 java.lang.management.ManagementFactory; + +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import ch.qos.logback.classic.spi.LoggerContextListener; +import ch.qos.logback.core.boolex.EventEvaluator; +import ch.qos.logback.core.spi.LifeCycle; +import org.xml.sax.Attributes; + +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.jmx.JMXConfigurator; +import ch.qos.logback.classic.jmx.MBeanUtil; +import ch.qos.logback.core.joran.action.Action; +import ch.qos.logback.core.joran.spi.ActionException; +import ch.qos.logback.core.joran.spi.InterpretationContext; +import ch.qos.logback.core.util.OptionHelper; + +public class LoggerContextListenerAction extends Action { + boolean inError = false; + LoggerContextListener lcl; + + @Override + public void begin(InterpretationContext ec, String name, Attributes attributes) + throws ActionException { + + inError = false; + + String className = attributes.getValue(CLASS_ATTRIBUTE); + if (OptionHelper.isEmpty(className)) { + addError("Mandatory \"" + CLASS_ATTRIBUTE + + "\" attribute not set for <loggerContextListener> element"); + inError = true; + return; + } + + try { + lcl = (LoggerContextListener) OptionHelper.instantiateByClassName( + className, LoggerContextListener.class, context); + + ec.pushObject(lcl); + addInfo("Adding LoggerContextListener of type [" + className + + "] to the object stack"); + + } catch (Exception oops) { + inError = true; + addError("Could not create LoggerContextListener of type " + className + "].", oops); + } + } + + @Override + public void end(InterpretationContext ec, String name) throws ActionException { + if (inError) { + return; + } + Object o = ec.peekObject(); + + if (o != lcl) { + addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier."); + } else { + ec.popObject(); + } + } + +} ----------------------------------------------------------------------- Summary of changes: .../joran/action/LoggerContextListenerAction.java | 80 ++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) create mode 100644 logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java hooks/post-receive -- Logback: the generic, reliable, fast and flexible logging framework.
participants (1)
-
git-noreply@pixie.qos.ch