From b24f4eafc635d7976106a87cc8fc79907ea75457 Mon Sep 17 00:00:00 2001 From: Yejun Yang Date: Tue, 19 May 2015 17:43:00 -0700 Subject: [PATCH] avoid message toString when debug not enabled --- src/main/java/com/pinterest/secor/reader/MessageReader.java | 2 +- src/main/java/com/pinterest/secor/writer/MessageWriter.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/pinterest/secor/reader/MessageReader.java b/src/main/java/com/pinterest/secor/reader/MessageReader.java index 12ccc22ff..a88ecbf6c 100644 --- a/src/main/java/com/pinterest/secor/reader/MessageReader.java +++ b/src/main/java/com/pinterest/secor/reader/MessageReader.java @@ -150,7 +150,7 @@ public Message read() { updateAccessTime(topicPartition); // Skip already committed messages. long committedOffsetCount = mOffsetTracker.getTrueCommittedOffsetCount(topicPartition); - LOG.debug("read message" + message); + LOG.debug("read message {}", message); exportStats(); if (message.getOffset() < committedOffsetCount) { LOG.debug("skipping message message " + message + " because its offset precedes " + diff --git a/src/main/java/com/pinterest/secor/writer/MessageWriter.java b/src/main/java/com/pinterest/secor/writer/MessageWriter.java index c56c5c7b1..dd4c3f8a3 100644 --- a/src/main/java/com/pinterest/secor/writer/MessageWriter.java +++ b/src/main/java/com/pinterest/secor/writer/MessageWriter.java @@ -84,7 +84,7 @@ public void write(ParsedMessage message) throws Exception { mFileExtension); FileWriter writer = mFileRegistry.getOrCreateWriter(path, mCodec); writer.write(new KeyValue(message.getOffset(), message.getPayload())); - LOG.debug("appended message " + message + " to file " + path.getLogFilePath() + - ". File length " + writer.getLength()); + LOG.debug("appended message {} to file {}. File length {}", + message, path.getLogFilePath(), writer.getLength()); } }