You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/01/06 11:14:19 UTC
[camel] 01/02: CAMEL-17417: camel-core - Route stack trace to include source file:line
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f712ed9aa77d121d623e173f8629808f36d7b110
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jan 6 12:06:23 2022 +0100
CAMEL-17417: camel-core - Route stack trace to include source file:line
---
.../java/org/apache/camel/support/MessageHelper.java | 19 +++++++++++--------
.../ROOT/pages/camel-3x-upgrade-guide-3_15.adoc | 20 ++++++++++----------
2 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
index fd98a0f..7959313 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java
@@ -49,8 +49,8 @@ import org.slf4j.Logger;
@EagerClassloaded
public final class MessageHelper {
- private static final String MESSAGE_HISTORY_HEADER = "%-30s %-20s %-20s %-50s %-12s";
- private static final String MESSAGE_HISTORY_OUTPUT = "%-30.30s %-20.20s %-20.20s %-50.50s %12.12s";
+ private static final String MESSAGE_HISTORY_HEADER = "%-40s %-30s %-50s %-12s";
+ private static final String MESSAGE_HISTORY_OUTPUT = "%-40.40s %-30.30s %-50.50s %12.12s";
/**
* Utility classes should not have a public constructor.
@@ -570,13 +570,16 @@ public final class MessageHelper {
"---------------------------------------------------------------------------------------------------------------------------------------\n");
String goMessageHistoryHeader = exchange.getContext().getGlobalOption(Exchange.MESSAGE_HISTORY_HEADER_FORMAT);
sb.append(String.format(goMessageHistoryHeader == null ? MESSAGE_HISTORY_HEADER : goMessageHistoryHeader,
- "Location", "RouteId", "ProcessorId", "Processor", "Elapsed (ms)"));
+ "Source", "ID", "Processor", "Elapsed (ms)"));
sb.append("\n");
// add incoming origin of message on the top
String routeId = exchange.getFromRouteId();
Route route = exchange.getContext().getRoute(routeId);
- String loc = route != null ? route.getSourceLocation() : "";
+ String loc = route != null ? route.getSourceLocation() : null;
+ if (loc == null) {
+ loc = "";
+ }
String id = routeId;
String label = "";
if (exchange.getFromEndpoint() != null) {
@@ -587,7 +590,7 @@ public final class MessageHelper {
String goMessageHistoryOutput = exchange.getContext().getGlobalOption(Exchange.MESSAGE_HISTORY_OUTPUT_FORMAT);
goMessageHistoryOutput = goMessageHistoryOutput == null ? MESSAGE_HISTORY_OUTPUT : goMessageHistoryOutput;
- sb.append(String.format(goMessageHistoryOutput, loc, routeId, id, label, elapsed));
+ sb.append(String.format(goMessageHistoryOutput, loc, routeId + "/" + id, label, elapsed));
sb.append("\n");
if (list == null || list.isEmpty()) {
@@ -613,7 +616,7 @@ public final class MessageHelper {
// we do not have elapsed time
elapsed = 0;
sb.append("\t...\n");
- sb.append(String.format(goMessageHistoryOutput, loc, routeId, id, label, elapsed));
+ sb.append(String.format(goMessageHistoryOutput, loc, routeId + "/" + id, label, elapsed));
sb.append("\n");
}
} else {
@@ -635,7 +638,7 @@ public final class MessageHelper {
label = URISupport.sanitizeUri(StringHelper.limitLength(history.getNode().getLabel(), 100));
elapsed = history.getElapsed();
- sb.append(String.format(goMessageHistoryOutput, loc, routeId, id, label, elapsed));
+ sb.append(String.format(goMessageHistoryOutput, loc, routeId + "/" + id, label, elapsed));
sb.append("\n");
}
}
@@ -651,7 +654,7 @@ public final class MessageHelper {
if (logStackTrace) {
sb.append("\nStacktrace\n");
sb.append(
- "---------------------------------------------------------------------------------------------------------------------------------------\n");
+ "---------------------------------------------------------------------------------------------------------------------------------------");
}
return sb.toString();
}
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
index cae9fd0..011e4d2 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
@@ -22,16 +22,16 @@ Removed the deprecated `Classic` value from `startupSummaryLevel` enums.
==== Message History
-The message history output now includes a source column, which refers to the Java class/XML file
+The message history output has changed to include source column, which refers to the Java class/XML file
from the DSL the message was at the given time. (line precise error reporting).
-This means there is now 5 columns and the defaults are:
+This default formatting are (Source, ID, Processor, Elapsed):
```
-MESSAGE_HISTORY_HEADER = "%-30s %-20s %-20s %-50s %-12s";
-MESSAGE_HISTORY_OUTPUT = "%-30.30s %-20.20s %-20.20s %-50.50s %12.12s";
+ MESSAGE_HISTORY_HEADER = "%-40s %-30s %-50s %-12s";
+ MESSAGE_HISTORY_OUTPUT = "%-40.40s %-30.30s %-50.50s %12.12s";
```
-If you are using custom sizes then you need to adjust from 4 to 5 columns.
+If you are using custom sizes then you need to adjust accordingly.
=== camel-endpointdsl
@@ -83,16 +83,16 @@ This should correctly be done with `steps` as child of `from`:
- log: "message"
----
+=== camel-jbang
+
+The JBang app that was previously named `CamelJBang` is now named `camel`. It is still possible to use the older name by installing it using `CamelJBang@apache/camel` but this approach is deprecated and should not be used in the future.
+
=== camel-karaf
The `camel-endpointdsl` and `camel-componentdsl` is no longer supported on Apache Karaf.
The `camel-osg-activator` has been removed.
-=== camel-jbang
-
-The JBang app that was previously named `CamelJBang` is now named `camel`. It is still possible to use the older name by installing it using `CamelJBang@apache/camel` but this approach is deprecated and should not be used in the future.
-
=== camel-quartz
-Removed the option `startDelaySeconds` as this does not work correctly and causes problems if in use.
\ No newline at end of file
+Removed the option `startDelaySeconds` as this does not work correctly and causes problems if in use.