michaeljmarshall commented on a change in pull request #13535:
URL: https://github.com/apache/pulsar/pull/13535#discussion_r822318974
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -4554,10 +4555,28 @@ protected void internalGetLastMessageId(AsyncResponse
asyncResponse, boolean aut
protected void handleTopicPolicyException(String methodName, Throwable
thr, AsyncResponse asyncResponse) {
Throwable cause = thr.getCause();
- if (!(cause instanceof WebApplicationException)
- || !(((WebApplicationException)
cause).getResponse().getStatus() == 307)) {
- log.error("[{}] Failed to perform {} on topic {}",
- clientAppId(), methodName, topicName, cause);
+
+ Level logLevel = null;
+ if (cause instanceof WebApplicationException) {
+ int statusCode = ((WebApplicationException)
cause).getResponse().getStatus();
+ if (statusCode == Status.NOT_FOUND.getStatusCode()) {
+ logLevel = Level.WARN;
+ } else if (statusCode !=
Status.TEMPORARY_REDIRECT.getStatusCode()) {
+ logLevel = Level.ERROR;
+ }
+ } else {
+ logLevel = Level.ERROR;
+ }
+
+ if (logLevel != null) {
+ switch (logLevel) {
+ case WARN:
+ log.warn("[{}] Failed to perform {} on topic {}",
clientAppId(), methodName, topicName, cause);
Review comment:
It seems like we could avoid logging the stack trace. What do you think
@nodece?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]