fix(logging): reduce log level of errors in introspection and login UI (#8047)

# Which Problems Are Solved

Introspection errors such as invalid audience and errors in the login UI
such as invalid user agents where all logged as severity error.

# How the Problems Are Solved

Log level for both general loggers is changed to `info`.

# Additional Changes

None

# Additional Context

- internal discussion
This commit is contained in:
Livio Spring
2024-05-31 10:11:32 +02:00
committed by GitHub
parent aabefb9382
commit bc885632fb
2 changed files with 10 additions and 2 deletions

View File

@@ -80,7 +80,11 @@ func (s *Server) Introspect(ctx context.Context, r *op.Request[op.IntrospectionR
// with active: false
defer func() {
if err != nil {
s.getLogger(ctx).ErrorContext(ctx, "oidc introspection", "err", err)
if zerrors.IsInternal(err) {
s.getLogger(ctx).ErrorContext(ctx, "oidc introspection", "err", err)
} else {
s.getLogger(ctx).InfoContext(ctx, "oidc introspection", "err", err)
}
resp, err = op.NewResponse(new(oidc.IntrospectionResponse)), nil
}
}()

View File

@@ -342,7 +342,11 @@ func (l *Login) renderInternalError(w http.ResponseWriter, r *http.Request, auth
if authReq != nil {
log = log.WithField("auth_req_id", authReq.ID)
}
log.Error()
if zerrors.IsInternal(err) {
log.Error()
} else {
log.Info()
}
_, msg = l.getErrorMessage(r, err)
}