diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java index a605f312c6e22..f897757d7b25f 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java @@ -1273,12 +1273,13 @@ protected void handleProducer(final CommandProducer cmdProducer) { return null; } + // Do not print stack traces for expected exceptions if (cause instanceof NoSuchElementException) { cause = new TopicNotFoundException("Topic Not Found."); - } - if (!Exceptions.areExceptionsPresentInChain(cause, + log.info("[{}] Failed to load topic {}, producerId={}: Topic not found", remoteAddress, topicName, + producerId); + } else if (!Exceptions.areExceptionsPresentInChain(cause, ServiceUnitNotReadyException.class, ManagedLedgerException.class)) { - // Do not print stack traces for expected exceptions log.error("[{}] Failed to create topic {}, producerId={}", remoteAddress, topicName, producerId, exception); }