You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2025/02/11 10:14:42 UTC
(tomcat) branch 9.0.x updated: Additional log tweaks
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new f81323b5e3 Additional log tweaks
f81323b5e3 is described below
commit f81323b5e379862efab4af6ac4d47787d71f5620
Author: remm <re...@apache.org>
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org