Command logging fixed. #1035

pull/1038/merge
Nikita 8 years ago
parent 727c4523cb
commit 1ab3cb3052

@ -240,9 +240,9 @@ public class CommandDecoder extends ReplayingDecoder<State> {
+ ". channel: " + channel + " data: " + data));
} else {
if (data != null) {
data.tryFailure(new RedisException(error + ". channel: " + channel + " command: " + data));
data.tryFailure(new RedisException(error + ". channel: " + channel + " command: " + LogHelper.toString(data)));
} else {
log.error("Error: {} channel: {} data: {}", error, channel, data);
log.error("Error: {} channel: {} data: {}", error, channel, LogHelper.toString(data));
}
}
} finally {
@ -320,7 +320,7 @@ public class CommandDecoder extends ReplayingDecoder<State> {
parts.add(result);
} else {
if (data != null && !data.getPromise().trySuccess(result) && data.cause() instanceof RedisTimeoutException) {
log.warn("response has been skipped due to timeout! channel: {}, command: {}, result: {}", channel, data, result);
log.warn("response has been skipped due to timeout! channel: {}, command: {}, result: {}", channel, LogHelper.toString(data), LogHelper.toString(result));
}
}
}

@ -18,6 +18,8 @@ package org.redisson.misc;
import java.lang.reflect.Array;
import java.util.Collection;
import org.redisson.client.protocol.CommandData;
/**
* @author Philipp Marx
*/
@ -38,6 +40,9 @@ public class LogHelper {
return toArrayString(object);
} else if (object instanceof Collection) {
return toCollectionString((Collection<?>) object);
} else if (object instanceof CommandData) {
CommandData cd = (CommandData)object;
return cd.getCommand() + ", params: " + LogHelper.toString(cd.getParams());
} else {
return String.valueOf(object);
}

Loading…
Cancel
Save