Skip to content

Commit 7b1d746

Browse files
feat(website): Optimize website error_log configuration (#7173)
Refs **#7161
1 parent 7dc0a2f commit 7b1d746

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

backend/app/service/website.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,19 +1052,19 @@ func (w WebsiteService) OpWebsiteLog(req request.WebsiteLogReq) (*response.Websi
10521052
res.Content = strings.Join(lines, "\n")
10531053
return res, nil
10541054
case constant.DisableLog:
1055-
key := "access_log"
1055+
params := dto.NginxParam{}
10561056
switch req.LogType {
10571057
case constant.AccessLog:
1058+
params.Name = "access_log"
1059+
params.Params = []string{"off"}
10581060
website.AccessLog = false
10591061
case constant.ErrorLog:
1060-
key = "error_log"
1062+
params.Name = "error_log"
1063+
params.Params = []string{"/dev/null", "crit"}
10611064
website.ErrorLog = false
10621065
}
10631066
var nginxParams []dto.NginxParam
1064-
nginxParams = append(nginxParams, dto.NginxParam{
1065-
Name: key,
1066-
Params: []string{"off"},
1067-
})
1067+
nginxParams = append(nginxParams, params)
10681068

10691069
if err := updateNginxConfig(constant.NginxScopeServer, nginxParams, &website); err != nil {
10701070
return nil, err

0 commit comments

Comments
 (0)