Skip to content

Commit d4cc6ef

Browse files
committed
fix: reduce WebDAV logging for NotFoundError
Skip logging full error stack trace for NotFoundError when a file doesn't exist, as this is a normal case and not a program error. Use DEBUG level instead of ERROR to reduce log noise. Fixes #9141
1 parent 39c236b commit d4cc6ef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/webdav.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"path"
1010
"strings"
1111

12+
"github.com/alist-org/alist/v3/internal/errs"
1213
"github.com/alist-org/alist/v3/internal/stream"
1314
"github.com/alist-org/alist/v3/server/middlewares"
1415

@@ -31,6 +32,12 @@ func WebDav(dav *gin.RouterGroup) {
3132
Prefix: path.Join(conf.URL.Path, "/dav"),
3233
LockSystem: webdav.NewMemLS(),
3334
Logger: func(request *http.Request, err error) {
35+
// Skip logging for NotFoundError as it's not a program error
36+
// but a normal case when a file doesn't exist
37+
if errs.IsNotFoundError(err) {
38+
log.Debugf("%s %s %v", request.Method, request.URL.Path, err)
39+
return
40+
}
3441
log.Errorf("%s %s %+v", request.Method, request.URL.Path, err)
3542
},
3643
}

0 commit comments

Comments
 (0)