Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35B55969C for ; Tue, 25 Oct 2011 17:56:08 +0000 (UTC) Received: (qmail 97606 invoked by uid 500); 25 Oct 2011 17:56:08 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 97581 invoked by uid 500); 25 Oct 2011 17:56:08 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 97574 invoked by uid 99); 25 Oct 2011 17:56:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 17:56:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 17:56:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B3B8523888FD; Tue, 25 Oct 2011 17:55:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1188834 - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: log4j2-api/src/main/java/org/apache/logging/log4j/message/ log4j2-core/src/main/java/org/apache/logging/log4j/core/ log4j2-core/src/main/java/org/apache/logging/log4j/cor... Date: Tue, 25 Oct 2011 17:55:46 -0000 To: commits@logging.apache.org From: rgoers@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111025175546.B3B8523888FD@eris.apache.org> Author: rgoers Date: Tue Oct 25 17:55:46 2011 New Revision: 1188834 URL: http://svn.apache.org/viewvc?rev=1188834&view=rev Log: Add TimestampMessage Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/TimestampMessage.java Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/TimestampMessage.java URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/TimestampMessage.java?rev=1188834&view=auto ============================================================================== --- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/TimestampMessage.java (added) +++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-api/src/main/java/org/apache/logging/log4j/message/TimestampMessage.java Tue Oct 25 17:55:46 2011 @@ -0,0 +1,9 @@ +package org.apache.logging.log4j.message; + +/** + * Messages that use this interface will cause the timestamp in the message to be used instead of the timestmap in + * the LogEvent. + */ +public interface TimestampMessage { + long getTimestamp(); +} Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java?rev=1188834&r1=1188833&r2=1188834&view=diff ============================================================================== --- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java (original) +++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Logger.java Tue Oct 25 17:55:46 2011 @@ -22,6 +22,7 @@ import org.apache.logging.log4j.core.con import org.apache.logging.log4j.core.config.LoggerConfig; import org.apache.logging.log4j.core.filter.CompositeFilter; import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.SimpleMessage; import org.apache.logging.log4j.spi.AbstractLogger; import java.util.ArrayList; @@ -108,6 +109,9 @@ public class Logger extends AbstractLogg @Override public void log(Marker marker, String fqcn, Level level, Message data, Throwable t) { + if (data == null) { + data = new SimpleMessage(""); + } config.loggerConfig.log(name, marker, fqcn, level, data, t); } Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java?rev=1188834&r1=1188833&r2=1188834&view=diff ============================================================================== --- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java (original) +++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java Tue Oct 25 17:55:46 2011 @@ -22,6 +22,7 @@ import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.message.LoggerNameAwareMessage; import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.TimestampMessage; import java.io.InvalidObjectException; import java.io.ObjectInputStream; @@ -88,7 +89,7 @@ public class Log4jLogEvent implements Lo this.throwable = t == null ? null : new ThrowableProxy(t); this.mdc = mdc; this.ndc = ndc; - this.timestamp = timestamp; + this.timestamp = message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : timestamp; this.threadName = threadName; this.location = location; if (message != null && message instanceof LoggerNameAwareMessage) {