[LOGBack-dev] svn commit: r514 - logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi

noreply.seb at qos.ch noreply.seb at qos.ch
Wed Sep 6 11:51:32 CEST 2006


Author: seb
Date: Wed Sep  6 11:51:32 2006
New Revision: 514

Added:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
      - copied, changed from r513, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent2.java
Removed:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent2.java

Log:
cleaning class names:
- Externalized LoggingEvent is now called LoggingEventExt
- Serialized LoggingEvent is now LoggingEvent.
changed names of builder classes accordingly

Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java (from r513, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent2.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent2.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java	Wed Sep  6 11:51:32 2006
@@ -18,6 +18,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Marker;
+import org.slf4j.impl.MessageFormatter;
 
 import ch.qos.logback.classic.Level;
 
@@ -37,7 +38,7 @@
  * @author Ceki Gülcü
  * @author Sébastien Pennec
  */
-public class LoggingEvent2 implements Serializable {
+public class LoggingEvent implements Serializable {
 
 	/**
 	 * 
@@ -75,13 +76,15 @@
 	private transient Level level;
 
 	private String message;
+	private String formattedMessage;
+
 	private Object[] argumentArray;
 
 	private transient Logger logger;
 
-	transient private ThrowableInformation throwableInfo;
+  private transient ThrowableInformation throwableInfo;
 
-	transient private CallerData[] callerDataArray;
+	private transient CallerData[] callerDataArray;
 
 	private Marker marker;
 
@@ -91,11 +94,11 @@
 	 */
 	private long timeStamp;
 
-	public LoggingEvent2() {
+	public LoggingEvent() {
 	}
 
-	public LoggingEvent2(String fqcn, Logger logger, Level level, String message,
-			Throwable throwable) {
+	public LoggingEvent(String fqcn, Logger logger, Level level, String message,
+			Throwable throwable, Object[] argArray) {
 		this.fqnOfLoggerClass = fqcn;
 		this.logger = logger;
 		this.level = level;
@@ -104,6 +107,12 @@
 		if (throwable != null) {
 			this.throwableInfo = new ThrowableInformation(throwable);
 		}
+
+		if (argArray != null) {
+			formattedMessage = MessageFormatter.arrayFormat(message, argArray);
+		} else {
+			formattedMessage = message;
+		}
 		timeStamp = System.currentTimeMillis();
 	}
 
@@ -250,20 +259,24 @@
 		}
 		this.marker = marker;
 	}
-	
+
+	public String getFormattedMessage() {
+		return formattedMessage;
+	}
+
 	private void writeObject(ObjectOutputStream out) throws IOException {
 		out.defaultWriteObject();
 		out.writeObject(logger.getName());
 		out.writeInt(level.levelInt);
 	}
 
-	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+	private void readObject(ObjectInputStream in) throws IOException,
+			ClassNotFoundException {
 		in.defaultReadObject();
-		String loggerName = (String)in.readObject();
+		String loggerName = (String) in.readObject();
 		logger = LoggerFactory.getLogger(loggerName);
 		int levelInt = in.readInt();
 		level = Level.toLevel(levelInt);
 	}
-	
-	
+
 }



More information about the logback-dev mailing list