Skip to content

Commit

Permalink
eclipse-ditto#985 fix message format of connection logs
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
  • Loading branch information
dguggemos committed Mar 26, 2021
1 parent 79f6477 commit 5703e35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ private Pair<ActorRef, ActorRef> startOutboundActors(final Connection connection
logger);
outboundMappingProcessor = OutboundMappingProcessor.of(settings);
} catch (final DittoRuntimeException dre) {
connectionLogger.failure("Failed to start message mapping processor due to: {}.", dre.getMessage());
connectionLogger.failure("Failed to start message mapping processor due to: {0}.", dre.getMessage());
logger.info("Got DittoRuntimeException during initialization of MessageMappingProcessor: {} {} - desc: {}",
dre.getClass().getSimpleName(), dre.getMessage(), dre.getDescription().orElse(""));
throw dre;
Expand Down Expand Up @@ -1593,7 +1593,7 @@ private ActorRef startInboundMappingProcessorActor(final Connection connection,
protocolAdapter,
logger);
} catch (final DittoRuntimeException dre) {
connectionLogger.failure("Failed to start message mapping processor due to: {}.", dre.getMessage());
connectionLogger.failure("Failed to start message mapping processor due to: {0}.", dre.getMessage());
logger.info("Got DittoRuntimeException during initialization of MessageMappingProcessor: {} {} - desc: {}",
dre.getClass().getSimpleName(), dre.getMessage(), dre.getDescription().orElse(""));
throw dre;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ private void handleInvalidResponse(final String message, final CommandResponse<?
} else if (commandResponse instanceof MessageCommandResponse) {
return (MessageCommandResponse<?, ?>) commandResponse;
} else {
connectionLogger.failure("Expected <{}> to be of type <{}> but was of type <{}>.",
connectionLogger.failure("Expected <{0}> to be of type <{1}> but was of type <{2}>.",
commandResponse, MessageCommandResponse.class.getSimpleName(),
commandResponse.getClass().getSimpleName());
return null;
Expand All @@ -488,7 +488,8 @@ private void handleInvalidResponse(final String message, final CommandResponse<?
return SendFeatureMessageResponse.of(messageCommand.getThingEntityId(),
sendFeatureMessage.getFeatureId(), message, status, dittoHeaders);
default:
connectionLogger.failure("Initial message command type <{}> is unknown.", messageCommand.getType());
connectionLogger.failure("Initial message command type <{0}> is unknown.",
messageCommand.getType());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public void handleShutdownSignal(final String consumerTag, final ShutdownSignalE
final String consumingQueueByTag = consumedTagsToAddresses.get(consumerTag);
if (null != consumingQueueByTag) {
connectionLogger.failure(
"Consumer with queue <{}> shutdown as the channel or the underlying connection has " +
"Consumer with queue <{0}> shutdown as the channel or the underlying connection has " +
"been shut down.", consumingQueueByTag);
logger.warning("Consumer with queue <{}> shutdown as the channel or the underlying connection has " +
"been shut down on connection <{}>.", consumingQueueByTag, connectionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void handleConnectResult(final ConnectFuture connectFuture) throws IOExc
.ifPresent(c -> c.accept(new ClientSessionCredentialsVisitor(sshSession, logger)));
pipeToSelf(sshSession.auth());
} else {
connectionLogger.failure("SSH connection failed: {}", getMessage(connectFuture.getException()));
connectionLogger.failure("SSH connection failed: {0}", getMessage(connectFuture.getException()));
notifyParentAndCleanup("Failed to connect to ssh server", connectFuture.getException());
}
}
Expand All @@ -192,18 +192,18 @@ private void handleAuthResult(final AuthFuture authFuture) {
final TunnelStarted tunnelStarted = new TunnelStarted(localAddress.getPort());
getContext().getParent().tell(tunnelStarted, getSelf());
} catch (final Exception ioException) {
connectionLogger.failure("SSH session authentication failed: {}", getMessage(ioException));
connectionLogger.failure("SSH session authentication failed: {0}", getMessage(ioException));
notifyParentAndCleanup("Failed to start local port forwarding", ioException);
}
} else {
connectionLogger.failure("SSH session authentication failed: {}", getMessage(authFuture.getException()));
connectionLogger.failure("SSH session authentication failed: {0}", getMessage(authFuture.getException()));
notifyParentAndCleanup("Failed to authenticate at SSH server.", authFuture.getException());
}
}

private void handleTunnelClosed(final TunnelClosed tunnelClosed) {
if (tunnelClosed.getError() != null) {
connectionLogger.failure("SSH Tunnel failed: ", getMessage(tunnelClosed.getError()));
connectionLogger.failure("SSH Tunnel failed: {0}", getMessage(tunnelClosed.getError()));
} else {
connectionLogger.success("SSH Tunnel closed.");
}
Expand Down

0 comments on commit 5703e35

Please sign in to comment.