-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
Describe the bug
My service uses otel. When printing logs through logc, the log format is deformed. I understand that traceid and spanid should be inside json, not in the outer layer.
-
The code is
logc.Infow(context.Background(), "CallBack request successfully.", logc.Field("reqId", params.Spec.ReqId))
-
The error is
trace_id=dfac27371ea9966e8da25340b5924dc7 span_id=6fe11f97dfa23e52{"@timestamp":"2025-08-26T13:49:09.815+08:00","caller":"task/task.go:88","content":"CallBack request successfully.","level":"info","reqId":"1960191682599202817","span":"6fe11f97dfa23e52","trace":"dfac27371ea9966e8da25340b5924dc7"}
Expected behavior
{"@timestamp":"2025-08-26T13:49:09.815+08:00","caller":"task/task.go:88","content":"CallBack request successfully.","level":"info","reqId":"1960191682599202817","span":"6fe11f97dfa23e52","trace":"dfac27371ea9966e8da25340b5924dc7"}
Environments (please complete the following information):
- OS: Ubuntu
- go-zero version:v1.7.3
- goctl version:1.23.0
More description
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels