Logging Setup is used to integrate the Go Agent with the logging system in the current service. It currently supports the recognition of Logrus
and Zap
frameworks. If neither of these frameworks is present, it would output logs using Std Error
.
You can learn about the configuration details through the “log” configuration item in the default settings.
The integration of the Agent with logs includes the two parts as following.
Agent logs output the current running status of the Agent system, most of which are execution exceptions. For example, communication anomalies between the Agent and the backend service, plugin execution exceptions, etc.
Integrating Agent logs into the service's logging system can effectively help users quickly troubleshoot whether there are issues with the current Agent execution.
The Agent would also enhance the existing logging system. When the service outputs log, if the current goroutine contains Tracing data, it would be outputted together with the current logs. This helps users to quickly locate the link based on the Tracing data.
The Tracing includes the following information:
N/A
.N/A
.-1
.The output format is as follows: [${ServiceName},${ServiceInstanceName},${TraceID},${SegmentID},${SpanID}]
.
The following is an example of a log output when using Zap.NewProduction
:
{"level":"info","ts":1683641507.052247,"caller":"gin/main.go:45","msg":"test log","SW_CTX":"[Your_ApplicationName,681e4178ee7311ed864facde48001122@192.168.50.193,6f13069eee7311ed864facde48001122,6f13070cee7311ed864facde48001122,0]"}