kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject git commit: kafka-1136; Add subAppend in Log4jAppender for generic usage; patched by Jie Huang; reviewed by Joel Koshy and Jun Rao
Date Fri, 22 Nov 2013 16:24:11 GMT
Updated Branches:
  refs/heads/trunk 99dd94c9b -> 2477a7468


kafka-1136; Add subAppend in Log4jAppender for generic usage; patched by Jie Huang; reviewed
by Joel Koshy and Jun Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/2477a746
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/2477a746
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/2477a746

Branch: refs/heads/trunk
Commit: 2477a7468e7bfe728abae793236d8aaf1c211d3b
Parents: 99dd94c
Author: Jie Huang <ie.huang@intel.com>
Authored: Fri Nov 22 08:25:05 2013 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Fri Nov 22 08:25:05 2013 -0800

----------------------------------------------------------------------
 .../main/scala/kafka/producer/KafkaLog4jAppender.scala  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/2477a746/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala b/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
index 88ae784..42239b2 100644
--- a/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
+++ b/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
@@ -87,15 +87,19 @@ class KafkaLog4jAppender extends AppenderSkeleton with Logging {
   }
 
   override def append(event: LoggingEvent)  {
-    val message : String = if( this.layout == null) {
-      event.getRenderedMessage
-    }
-    else this.layout.format(event)
+    val message = subAppend(event)
     LogLog.debug("[" + new Date(event.getTimeStamp).toString + "]" + message)
     val messageData = new KeyedMessage[String, String](topic, message)
     producer.send(messageData);
   }
 
+  def subAppend(event: LoggingEvent): String = {
+    if(this.layout == null)
+      event.getRenderedMessage
+    else
+      this.layout.format(event)
+  }
+
   override def close() {
     if(!this.closed) {
       this.closed = true


Mime
View raw message