Skip to content

Commit 7b78dd6

Browse files
lidelMarcoPolo
authored andcommitted
fix(websocket): use debug level for http.Server errors
#3364 migrated from zap to slog but accidentally changed the log level for http.Server.ErrorLog from implicit INFO to explicit ERROR. This caused client EOF and TLS handshake errors to spam error logs and stdout in apps which log only ERROR by default. These http.Server errors (client EOFs, TLS handshake failures from clients with naive TLS implementations, connection timeouts from clients that abort early) are normal operational noise, not actual server errors. Using LevelDebug: - matches semantic meaning (similar to existing connection timeout logs) - respects user's configured threshold (default ERROR filters them out) - allows users to enable for debugging via log level configuration Fixes ipfs/kubo#11027 Fixes ipfs/kubo#11033
1 parent bc0a6d5 commit 7b78dd6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

p2p/transport/websocket/listener.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ func newListener(a ma.Multiaddr, tlsConf *tls.Config, sharedTcp *tcpreuse.ConnMg
126126
},
127127
}
128128
ln.server = http.Server{
129-
Handler: ln,
130-
ErrorLog: slog.NewLogLogger(log.Handler(), slog.LevelError),
129+
Handler: ln,
130+
// Use LevelDebug for http.Server errors (TLS handshake failures, connection issues).
131+
// These are operational noise from misbehaving/buggy remote clients, not server errors.
132+
ErrorLog: slog.NewLogLogger(log.Handler(), slog.LevelDebug),
131133
ConnContext: ln.ConnContext,
132134
TLSConfig: tlsConf,
133135
}

0 commit comments

Comments
 (0)