ViliusS commented on code in PR #3586:
URL: https://github.com/apache/logging-log4j2/pull/3586#discussion_r2044531747


##########
log4j-layout-template-json/src/main/resources/GcpLayout.json:
##########
@@ -49,25 +55,15 @@
     "key": "span_id"
   },
   "logging.googleapis.com/trace_sampled": true,
-  "_exception": {
-    "class": {
-      "$resolver": "exception",
-      "field": "className"
-    },
-    "message": {
-      "$resolver": "exception",
-      "field": "message"
-    },
-    "stackTrace": {
-      "$resolver": "pattern",
-      "pattern": "%xEx"
-    }
+  "exception": {
+    "$resolver": "pattern",
+    "pattern": "%xEx"
   },

Review Comment:
   It seems that I first tested `exception` resolver without `stringify` 
parameter. This was a probable reason why it was not caught by Google Error 
Reporting dashboard. I have now re-tested with `stringify` -> `true` and this 
is what I've got.
   
   The look with `exception` resolver:
   
![image](https://github.com/user-attachments/assets/42a6a1ec-9162-4ea8-a06c-074f3427b1c2)
   
   This is how it looks with `%eXe` pattern:
   
![image](https://github.com/user-attachments/assets/7a5e4512-c0ef-4369-8126-898045a40571)
   
   This is the look on Error Reporting page (item 1 and 2 in the list):
   
![image](https://github.com/user-attachments/assets/a6dea5b5-f402-4a5a-a53c-dff6e1100fb6)
   
   If you ask me I would still preferred message + exception format (item 3 in 
the screenshot above). At least this is how other libraries and Java software 
reports exceptions to Error Reporting. See the comparison:
   
![image](https://github.com/user-attachments/assets/21939493-e0c2-413b-8ca4-94cee48735df)
   
   But to match this, we would need to remove `exception` field completely and 
rely only on `message` field, or have the same information duplicated to 
`exception` field, which I don't see the point.
   
   Anyway, if you prefer one format or another, I could adjust the patch. Keep 
in mind though that current patch doesn't change anything regarding exception 
format. Current JSON layout used %eXe all along. I just changed field name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to