title: Kafka console consumer get partition
body: <p>I'm using Kafka console consumer to consume messages from the topic with several partitions:</p>
  
  <pre><code>kafka-console-consumer.bat --bootstrap-server localhost:9092 --from-beginning --topic events
  </code></pre>
  
  <p>But it prints only message body. Is there any way to print record metadata or partition number as well? Cause I want to know where the message сonsumed from.</p>
  
  <p>I've explored console consumer doc <a href="http://documentation.kamanja.org/_static/command-ref/kafka-console-consumer.pdf" rel="noreferrer">http://documentation.kamanja.org/_static/command-ref/kafka-console-consumer.pdf</a> but didn't find any related properties.</p>
  
  <p><strong>UPDATED:</strong></p>
  
  <p>So, as I see the only solution is to override <em>DefaultMessageFormatter.class</em> (we can set it by running kafka console consumer with <em>--formatter</em> property) and add custom logic that prints record metadata in the #writeTo(..) method. </p>