This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new ecc2bc75ba Additional log tweaks
ecc2bc75ba is described below
commit ecc2bc75ba2987888bde72127c0cf9c726036566
Author: remm <[email protected]>
AuthorDate: Tue Feb 11 11:04:53 2025 +0100
Additional log tweaks
Repeating the exception message is likely wasteful, so simplify format.
---
java/org/apache/juli/JsonFormatter.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/java/org/apache/juli/JsonFormatter.java
b/java/org/apache/juli/JsonFormatter.java
index 5947e8ce46..22ed1625d6 100644
--- a/java/org/apache/juli/JsonFormatter.java
+++ b/java/org/apache/juli/JsonFormatter.java
@@ -32,9 +32,8 @@ import java.util.logging.LogRecord;
* <li>class: the class from which the log originated</li>
* <li>method: the method from which the log originated</li>
* <li>message: the log message</li>
- * <li>error: the message from an exception, if present</li>
- * <li>trace: the full stack trace from an exception, if present, represented
as an array of string
- * (the message first, then one string per stack trace element prefixed by a
string,
+ * <li>throwable: the full stack trace from an exception, if present,
represented as an array of string
+ * (the message first, then one string per stack trace element prefixed by a
whitespace,
* then moving on to the cause exception if any)</li>
* </ul>
*/
@@ -93,13 +92,8 @@ public class JsonFormatter extends OneLineFormatter {
if (t != null) {
sb.append("\", ");
- // Error
- sb.append("\"error\": \"");
- sb.append(JSONFilter.escape(t.toString()));
- sb.append("\", ");
-
// Stack trace
- sb.append("\"trace\": [");
+ sb.append("\"throwable\": [");
boolean first = true;
do {
if (!first) {
@@ -113,9 +107,9 @@ public class JsonFormatter extends OneLineFormatter {
}
t = t.getCause();
} while (t != null);
- sb.append("]");
+ sb.append(']');
} else {
- sb.append("\"");
+ sb.append('\"');
}
sb.append('}');
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]