Skip to content

logging: Ensure slog error level logs don't print stack traces#7512

Open
francislavoie wants to merge 1 commit intomasterfrom
log-without-stack
Open

logging: Ensure slog error level logs don't print stack traces#7512
francislavoie wants to merge 1 commit intomasterfrom
log-without-stack

Conversation

@francislavoie
Copy link
Member

@francislavoie francislavoie commented Feb 22, 2026

I noticed while testing an error case in cert issuance that sometimes we get stack traces in some logs, which is needlessly noisy (not useful for users, vaguely useful for devs sometimes but we can just enable it as needed while dev-ing).

I realized that zapslog (the zap-slog adapter) sets stack traces to be enabled at ERROR level by default. So we need to set it to a big number to make it not be turned on at all.

The actual problematic one was in certmagic, but I found a couple spots we could adjust in caddy as well. Certmagic PR to follow. caddyserver/certmagic#372

Assistance Disclosure

Used Github Copilot to learn that

@mholt
Copy link
Member

mholt commented Feb 26, 2026

Oh, thanks... I kind of like the stack traces though, when people post their logs I know exactly where to look and how the code got there, which is less obvious otherwise.

@francislavoie
Copy link
Member Author

francislavoie commented Feb 27, 2026

No you don't 😅 it looks like a crash/panic in that case, and it does not match the format of the rest of the logs (it escapes the usual single-line-log format and becomes separately formatted newline delimited content). It's also extremely noisy and unfriendly.

@mholt
Copy link
Member

mholt commented Feb 27, 2026

I agree it's not visually pleasing, but it IS useful to know how the code got to that point, which a stack trace shows us.

The newlines are consistent with the formatter though right? Like it's not producing invalid JSON.

Can we at least put a comment next to the lines setting the level to 127? It's unclear why without reading this PR.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants