This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new a57e32f360 Additional log tweaks
a57e32f360 is described below

commit a57e32f360394fb225a405086675b33eefb0d6c1
Author: remm <r...@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 d67ebb2110..b32f9bee75 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to