[logback-dev] svn commit: r742 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic main/java/ch/qos/logback/classic/joran/action main/java/ch/qos/logback/classic/pattern main/java/ch/qos/logback/classic/spi test/java/ch/qos/logback/classic/net

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Oct 23 18:54:25 CEST 2006


Author: ceki
Date: Mon Oct 23 18:54:25 2006
New Revision: 742

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextRemoteView.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/LoggingEventSerializationTest.java

Log:

- LoggingEventSerialization test now passes
- renaming of ch.qos.logback.core.joran.spi.ExecutionContext as InterpretationContext
- minor lincesing related corrections

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	Mon Oct 23 18:54:25 2006
@@ -61,6 +61,12 @@
       logger.buildRemoteView();
     }
   }
+  
+  @Override
+  public void setProperty(String key, String val) {
+    super.setProperty(key, val);
+    syncRemoteView();
+  }
 
   @Override
   public void setName(String name) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java	Mon Oct 23 18:54:25 2006
@@ -13,7 +13,7 @@
 import org.xml.sax.Attributes;
 
 import ch.qos.logback.core.joran.action.Action;
-import ch.qos.logback.core.joran.spi.ExecutionContext;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
 
 
 
@@ -21,7 +21,7 @@
   static final String INTERNAL_DEBUG_ATTR = "debug";
   boolean attachment = false;
 
-  public void begin(ExecutionContext ec, String name, Attributes attributes) {
+  public void begin(InterpretationContext ec, String name, Attributes attributes) {
     String debugAttrib = attributes.getValue(INTERNAL_DEBUG_ATTR);
 
     if (
@@ -36,7 +36,7 @@
     }
   }
 
-  public void end(ExecutionContext ec, String name) {
+  public void end(InterpretationContext ec, String name) {
     if (attachment) {
       addInfo("End of configuration.");
       //LoggerContext loggerContext = (LoggerContext) context;

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java	Mon Oct 23 18:54:25 2006
@@ -15,7 +15,7 @@
 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.spi.ExecutionContext;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
 
 
 public class LevelAction extends Action {
@@ -29,7 +29,7 @@
 
   boolean inError = false;
 
-  public void begin(ExecutionContext ec, String name, Attributes attributes) {
+  public void begin(InterpretationContext ec, String name, Attributes attributes) {
     Object o = ec.peekObject();
 
     if (!(o instanceof Logger)) {
@@ -55,9 +55,9 @@
     addInfo(loggerName + " level set to " + l.getLevel());
   }
 
-  public void finish(ExecutionContext ec) {
+  public void finish(InterpretationContext ec) {
   }
 
-  public void end(ExecutionContext ec, String e) {
+  public void end(InterpretationContext ec, String e) {
   }
 }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java	Mon Oct 23 18:54:25 2006
@@ -17,7 +17,7 @@
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.core.joran.action.Action;
 import ch.qos.logback.core.joran.action.ActionConst;
-import ch.qos.logback.core.joran.spi.ExecutionContext;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
 import ch.qos.logback.core.util.OptionHelper;
 
 
@@ -25,7 +25,7 @@
 public class LoggerAction extends Action {
   boolean inError = false;
   
-  public void begin(ExecutionContext ec, String name, Attributes attributes) {
+  public void begin(InterpretationContext ec, String name, Attributes attributes) {
     // Let us forget about previous errors (in this object)
     inError = false;
 
@@ -63,12 +63,12 @@
     ec.pushObject(l);
   }
 
-  public void end(ExecutionContext ec, String e) {
+  public void end(InterpretationContext ec, String e) {
     if (!inError) {
       ec.popObject();
     }
   }
 
-  public void finish(ExecutionContext ec) {
+  public void finish(InterpretationContext ec) {
   }
 }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java	Mon Oct 23 18:54:25 2006
@@ -15,7 +15,7 @@
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.core.joran.action.Action;
-import ch.qos.logback.core.joran.spi.ExecutionContext;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
 
 public class RootLoggerAction extends Action {
   static final String NAME_ATTR = "name";
@@ -27,7 +27,7 @@
   Logger root;
   boolean inError = false;
   
-  public void begin(ExecutionContext ec, String name, Attributes attributes) {
+  public void begin(InterpretationContext ec, String name, Attributes attributes) {
     inError = false;
     //logger.debug("In begin method");
 
@@ -38,7 +38,7 @@
     ec.pushObject(root);
   }
 
-  public void end(ExecutionContext ec, String name) {
+  public void end(InterpretationContext ec, String name) {
     //logger.debug("end() called.");
 
     if (inError) {
@@ -57,6 +57,6 @@
     }
   }
 
-  public void finish(ExecutionContext ec) {
+  public void finish(InterpretationContext ec) {
   }
 }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java	Mon Oct 23 18:54:25 2006
@@ -1,11 +1,11 @@
 /**
- * LOGBack: the reliable, fast and flexible logging library for Java.
- *
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ * 
  * Copyright (C) 1999-2006, QOS.ch
- *
- * This library is free software, you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation.
+ * 
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
  */
 package ch.qos.logback.classic.pattern;
 

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextRemoteView.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextRemoteView.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextRemoteView.java	Mon Oct 23 18:54:25 2006
@@ -1,3 +1,12 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ * 
+ * Copyright (C) 1999-2006, QOS.ch
+ * 
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
 package ch.qos.logback.classic.spi;
 
 import java.io.Serializable;
@@ -6,43 +15,44 @@
 import ch.qos.logback.classic.LoggerContext;
 
 /**
- * LoggerContextRemoteView offers a restricted view of LoggerContext intended to be 
- * exposed by LoggingEvent. This restricted view is optimised for serialisation.
+ * LoggerContextRemoteView offers a restricted view of LoggerContext intended to
+ * be exposed by LoggingEvent. This restricted view is optimised for
+ * serialisation.
  * 
- * Some of the LoggerContext or Logger attributes should not survive 
- * serialization, e.g appenders, level values etc, as these attributes may 
- * have other values on the remote platform. LoggerContextRemoteView class exposes 
- * the minimal (relevant) attributes to remote host, instead of having to deal with 
- * an incomplete LoggerContext with many null references.
+ * Some of the LoggerContext or Logger attributes should not survive
+ * serialization, e.g appenders, level values etc, as these attributes may have
+ * other values on the remote platform. LoggerContextRemoteView class exposes
+ * the minimal (relevant) attributes to remote host, instead of having to deal
+ * with an incomplete LoggerContext with many null references.
  * 
  * @author Ceki Gülcü
  * @author Sébastien Pennec
  */
 public class LoggerContextRemoteView implements Serializable {
 
-	
-	private static final long serialVersionUID = 5488023392483144387L;
+  private static final long serialVersionUID = 5488023392483144387L;
 
-	final String name;
-	final Map<String, String> propertyMap;
+  final String name;
+  final Map<String, String> propertyMap;
 
-	
-	public LoggerContextRemoteView(LoggerContext lc) {
-		//this(lc.getName(), lc.getPropertyMap());
-		this.name = lc.getName();
-		this.propertyMap = lc.getPropertyMap();
-	}
-	
-//	public LoggerContextRemoteView(String name, Map<String, String> propertyMap) {
-//		this.name = name;
-//		this.propertyMap = propertyMap;
-//	}
-	
-	public String getName() {
-		return name;
-	}
-	public Map<String, String> getPropertyMap() {
-		return propertyMap;
-	}
+  public LoggerContextRemoteView(LoggerContext lc) {
+    // this(lc.getName(), lc.getPropertyMap());
+    this.name = lc.getName();
+    this.propertyMap = lc.getPropertyMap();
+  }
+
+  // public LoggerContextRemoteView(String name, Map<String, String>
+  // propertyMap) {
+  // this.name = name;
+  // this.propertyMap = propertyMap;
+  // }
+
+  public String getName() {
+    return name;
+  }
+
+  public Map<String, String> getPropertyMap() {
+    return propertyMap;
+  }
 
 }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java	Mon Oct 23 18:54:25 2006
@@ -1,5 +1,5 @@
 /**
- * Logback: the reliable, generic, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
  * 
  * Copyright (C) 1999-2006, QOS.ch
  * 
@@ -25,26 +25,23 @@
  */
 public class LoggerRemoteView implements Serializable {
 
+  private static final long serialVersionUID = 5028223666108713696L;
 
-	private static final long serialVersionUID = 5028223666108713696L;
-
-	final LoggerContextRemoteView loggerContextView;
-	final String name;
-
-	public LoggerRemoteView(String name, LoggerContext lc) {
-		this.name = name;
-		assert lc.getLoggerContextRemoteView() != null;
-		loggerContextView = lc.getLoggerContextRemoteView();
-	}
-	
-	
-	public LoggerContextRemoteView getLoggerContextView() {
-		return loggerContextView;
-	}
-
-	public String getName() {
-		return name;
-	}
+  final LoggerContextRemoteView loggerContextView;
+  final String name;
 
+  public LoggerRemoteView(String name, LoggerContext lc) {
+    this.name = name;
+    assert lc.getLoggerContextRemoteView() != null;
+    loggerContextView = lc.getLoggerContextRemoteView();
+  }
+
+  public LoggerContextRemoteView getLoggerContextView() {
+    return loggerContextView;
+  }
+
+  public String getName() {
+    return name;
+  }
 
 }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/LoggingEventSerializationTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/LoggingEventSerializationTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/LoggingEventSerializationTest.java	Mon Oct 23 18:54:25 2006
@@ -79,6 +79,7 @@
     assertNotNull(loggerContextRemoteView);
     assertEquals("testContext", loggerContextRemoteView.getName());
     Map<String, String> props = loggerContextRemoteView.getPropertyMap();
+    assertNotNull(props);
     assertEquals("testValue", props.get("testKey"));
   }
   



More information about the logback-dev mailing list