diff --git a/src/core/nginx.go b/src/core/nginx.go index 7a76e74cd..6791d8d63 100644 --- a/src/core/nginx.go +++ b/src/core/nginx.go @@ -316,7 +316,19 @@ func hasConfPath(files []*proto.File, confPath string) bool { } func (n *NginxBinaryType) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error) { - log.Tracef("Writing config: %+v\n", config) + if log.IsLevelEnabled(log.TraceLevel) { + jsonLogger := log.New() + jsonLogger.SetFormatter(&log.JSONFormatter{}) + jsonLogger.WithFields(log.Fields{ + "access_logs": config.AccessLogs, + "error_logs": config.ErrorLogs, + "directory_map": config.DirectoryMap, + "config_contents": config.Zconfig, + "config_data": config.ConfigData, + "action": config.Action, + }).Trace("Writing config") + defer jsonLogger.Writer().Close() + } details, ok := n.nginxDetailsMap[config.ConfigData.NginxId] if !ok || details == nil { return nil, fmt.Errorf("NGINX instance %s not found", config.ConfigData.NginxId) diff --git a/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go b/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go index 7a76e74cd..6791d8d63 100644 --- a/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go +++ b/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go @@ -316,7 +316,19 @@ func hasConfPath(files []*proto.File, confPath string) bool { } func (n *NginxBinaryType) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error) { - log.Tracef("Writing config: %+v\n", config) + if log.IsLevelEnabled(log.TraceLevel) { + jsonLogger := log.New() + jsonLogger.SetFormatter(&log.JSONFormatter{}) + jsonLogger.WithFields(log.Fields{ + "access_logs": config.AccessLogs, + "error_logs": config.ErrorLogs, + "directory_map": config.DirectoryMap, + "config_contents": config.Zconfig, + "config_data": config.ConfigData, + "action": config.Action, + }).Trace("Writing config") + defer jsonLogger.Writer().Close() + } details, ok := n.nginxDetailsMap[config.ConfigData.NginxId] if !ok || details == nil { return nil, fmt.Errorf("NGINX instance %s not found", config.ConfigData.NginxId)