From e6ba3fbc71cd9e28ba0581dc69b9940a05332466 Mon Sep 17 00:00:00 2001 From: Dmitrii Tikhomirov Date: Mon, 12 Jun 2017 15:50:29 +0200 Subject: [PATCH] [ARTEMIS-1228] Log messages without prefixed id code in artemis-rest --- .../apache/activemq/artemis/rest/ActiveMQRestLogger.java | 8 ++++++++ .../activemq/artemis/rest/queue/push/UriStrategy.java | 2 +- .../activemq/artemis/rest/util/HttpMessageHelper.java | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQRestLogger.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQRestLogger.java index 524a9fd798..dbca778e61 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQRestLogger.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/ActiveMQRestLogger.java @@ -64,6 +64,14 @@ public interface ActiveMQRestLogger extends BasicLogger { @Message(id = 182001, value = "shutdown REST subscription because of timeout for: {0}", format = Message.Format.MESSAGE_FORMAT) void shutdownRestSubscription(String id); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 182002, value = "Failed to push message to {0}", format = Message.Format.MESSAGE_FORMAT) + void failedToPushMessageToUri(String uri, @Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 182003, value = "Failed to build Message from object", format = Message.Format.MESSAGE_FORMAT) + void failedToBuildMessageFromObject(@Cause Exception e); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 184000, value = "Failed to load push store {0}, it is probably corrupted", format = Message.Format.MESSAGE_FORMAT) void errorLoadingStore(@Cause Exception e, String name); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/UriStrategy.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/UriStrategy.java index 10c01d61d0..591c8e29d9 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/UriStrategy.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/UriStrategy.java @@ -175,7 +175,7 @@ public class UriStrategy implements PushStrategy { } } } catch (Exception e) { - ActiveMQRestLogger.LOGGER.warn("failed to push message to " + uri, e); + ActiveMQRestLogger.LOGGER.failedToPushMessageToUri(uri, e); return false; } finally { if (res != null) diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/HttpMessageHelper.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/HttpMessageHelper.java index a6e4c8ecfe..b04ba374c6 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/HttpMessageHelper.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/HttpMessageHelper.java @@ -83,7 +83,7 @@ public class HttpMessageHelper { ActiveMQRestLogger.LOGGER.debug("**** Building Message from object: " + obj.toString()); request.body(contentType, obj); } catch (Exception e) { - ActiveMQRestLogger.LOGGER.warn("Building Message from object", e.getMessage(), e); + ActiveMQRestLogger.LOGGER.failedToBuildMessageFromObject(e); throw new RuntimeException(e); } }