You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have written a logger using zap and the log message contains the fields from the previous log message as well. For example, below are two log lines.
logger.AgentId("agentId").JobId("jobId").Info("This info message")
logger.SiteName("siteName").Info("This info message")
The output from these two log lines is as follows:
{"level":"info","ts":"2022-08-26T18:48:54.427-0700","caller":"testprog/structlogger/logmain.go:21","msg":"This info message","service":"unknownPod","pod":"unknownPod-1","TraceId":"traceId","TenantOrgId":"tenantId","AgentId":"agentId","JobId":"jobId"}
{"level":"info","ts":"2022-08-26T18:48:54.427-0700","caller":"testprog/structlogger/logmain.go:22","msg":"This info message","service":"unknownPod","pod":"unknownPod-1","TraceId":"traceId","TenantOrgId":"tenantId","AgentId":"agentId","JobId":"jobId","SiteName":"siteName"}
The problem is that the second log line repeats the fields "AgentId" and "JobId" whereas it should just print the "SiteName".
I came across an old post (#622) related to this and am not sure what may cause this behavior.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have written a logger using zap and the log message contains the fields from the previous log message as well. For example, below are two log lines.
The output from these two log lines is as follows:
The problem is that the second log line repeats the fields "AgentId" and "JobId" whereas it should just print the "SiteName".
I came across an old post (#622) related to this and am not sure what may cause this behavior.
Beta Was this translation helpful? Give feedback.
All reactions