[ https://issues.apache.org/jira/browse/RATIS-603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947421#comment-16947421 ]
Tsz-wo Sze commented on RATIS-603: ---------------------------------- Thanks [~msingh] for the update. In ServerProtoUtils, - the logic of converting StateMachineLogEntryProto to a String is split into getSMLogString and toLogEntryString. How about moving the entire logic to getSMLogString? - To be consistent with other methods, let's also rename getSMLogString to toStateMachineLogEntryString. The change will looks like {code} @@ -65,14 +66,24 @@ public interface ServerProtoUtils { } static String toLogEntryString(LogEntryProto entry) { + return toLogEntryString(entry, null); + } + + static String toStateMachineLogEntryString(StateMachineLogEntryProto smLog, StateMachine stateMachine) { + if (stateMachine != null) { + return stateMachine.toSMLogEntryString(smLog); + } + final ByteString clientId = smLog.getClientId(); + return (clientId.isEmpty() ? "<empty clientId>" : ClientId.valueOf(clientId)) + ", cid=" + smLog.getCallId(); + } + + static String toLogEntryString(LogEntryProto entry, StateMachine stateMachine) { if (entry == null) { return null; } final String s; if (entry.hasStateMachineLogEntry()) { - final StateMachineLogEntryProto smLog = entry.getStateMachineLogEntry(); - final ByteString clientId = smLog.getClientId(); - s = ", " + (clientId.isEmpty()? "<empty clientId>": ClientId.valueOf(clientId)) + ", cid=" + smLog.getCallId(); + s = ", " + toStateMachineLogEntryString(entry.getStateMachineLogEntry(), stateMachine); {code} > Add a logStringSupplier for RaftServerImpl to optionally print SmLogEntry on > errors > ----------------------------------------------------------------------------------- > > Key: RATIS-603 > URL: https://issues.apache.org/jira/browse/RATIS-603 > Project: Ratis > Issue Type: New Feature > Components: server > Affects Versions: 0.4.0 > Reporter: Mukul Kumar Singh > Assignee: Mukul Kumar Singh > Priority: Major > Labels: ozone > Attachments: RATIS-603.001.patch, RATIS-603.002.patch, > RATIS-603.003.patch, RATIS-603.004.patch, RATIS-603.005.patch, > RATIS-603.006.patch > > > This jira proposes to add a SmLogEntryProto to toString converter so that > logEntry information can be printed on errors/exceptions. -- This message was sent by Atlassian Jira (v8.3.4#803005)