[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.28-7-g4804883

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Feb 3 22:11:29 CET 2011


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  4804883e64fc1a14719a28d81a2479c628a8de39 (commit)
      from  a444d428421d4ccdd63b7347299bafecf170d844 (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=4804883e64fc1a14719a28d81a2479c628a8de39
http://github.com/ceki/logback/commit/4804883e64fc1a14719a28d81a2479c628a8de39

commit 4804883e64fc1a14719a28d81a2479c628a8de39
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Feb 3 22:08:06 2011 +0100

    less drama in conditional processing in the absence of janino library on the cp

diff --git a/logback-classic/src/test/input/joran/conditional/withoutJanino.xml b/logback-classic/src/test/input/joran/conditional/withoutJanino.xml
index d506b04..9ea46dd 100644
--- a/logback-classic/src/test/input/joran/conditional/withoutJanino.xml
+++ b/logback-classic/src/test/input/joran/conditional/withoutJanino.xml
@@ -1,6 +1,8 @@
 
 <configuration>
 
+  <logger name="a" level="WARN"/>
+
   <if condition='property("HOSTNAME") != null'>
     <then>
       <root level="ERROR"/>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/ConditionalWithoutJanino.java b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/ConditionalWithoutJanino.java
index 4dee365..2f163e2 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/ConditionalWithoutJanino.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/ConditionalWithoutJanino.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, 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.boolex;
 
 import ch.qos.logback.classic.ClassicTestConstants;
@@ -37,6 +50,8 @@ public class ConditionalWithoutJanino {
     StatusPrinter.print(loggerContext);
     StatusChecker checker = new StatusChecker(loggerContext);
     assertTrue(checker.containsMatch(IfAction.MISSING_JANINO_MSG));
+
+    assertSame(Level.WARN, loggerContext.getLogger("a").getLevel());
     assertSame(Level.WARN, root.getLevel());
   }
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
index 7a77f1a..e812490 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, 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.core.joran.conditional;
 
 import java.util.List;
@@ -124,6 +137,11 @@ public class IfAction extends Action {
 
   }
 
+  public boolean isActive() {
+    if(stack == null) return false;
+    if(stack.isEmpty()) return false;
+    return stack.peek().active;
+  }
 }
 
 class IfState {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
index 64f7716..d14e0e5 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2011, 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.core.joran.conditional;
 
 import java.lang.reflect.InvocationTargetException;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
index 1b52a8c..025f512 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
@@ -32,6 +32,9 @@ abstract public class ThenOrElseActionBase extends Action {
   @Override
   public void begin(InterpretationContext ic, String name, Attributes attributes)
       throws ActionException {
+
+    if(!weAreActive(ic)) return;
+
     ThenActionState state = new ThenActionState();
     if (ic.isListenerListEmpty()) {
       ic.addInPlayListener(state);
@@ -40,8 +43,17 @@ abstract public class ThenOrElseActionBase extends Action {
     stateStack.push(state);
   }
 
+  boolean weAreActive(InterpretationContext ic) {
+    Object o = ic.peekObject();
+    if(!(o instanceof IfAction)) return false;
+    IfAction ifAction = (IfAction) o;
+    return ifAction.isActive();
+  }
+
   @Override
   public void end(InterpretationContext ic, String name) throws ActionException {
+    if(!weAreActive(ic)) return;
+
     ThenActionState state = stateStack.pop();
     if (state.isRegistered) {
       ic.removeInPlayListener(state);

-----------------------------------------------------------------------

Summary of changes:
 .../test/input/joran/conditional/withoutJanino.xml |    2 ++
 .../classic/boolex/ConditionalWithoutJanino.java   |   15 +++++++++++++++
 .../logback/core/joran/conditional/IfAction.java   |   18 ++++++++++++++++++
 .../conditional/PropertyEvalScriptBuilder.java     |   13 +++++++++++++
 .../joran/conditional/ThenOrElseActionBase.java    |   12 ++++++++++++
 5 files changed, 60 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list