Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace #10

Open
arins opened this issue Aug 6, 2024 · 1 comment
Open

Stack trace #10

arins opened this issue Aug 6, 2024 · 1 comment

Comments

@arins
Copy link

arins commented Aug 6, 2024

Shouldn't the stacktrace be outputed within a key?

stacktrace=some stacktrace

output.Write(exception.StackTrace.Replace("\n", "").Replace("\r",""));

currently it is just printed out is that really valid logfmt? Grafana cloud skips it what I can see.

@wavedeck
Copy link

As of my comment, the logfmt serialization format does not have an official specification or RFC available to describe how the format has to be structured. So printing out stack traces without a key, regardless if on a single or multiple lines technically does not go against the logfmt structure.

I do not believe that Heroku (who is said to have brought this format to public attention) is coming up with an official specification any time soon, so this decision of format will be a community effort until logfmt gets more popular.

I also agree that stack traces should get their own key assigned, which in turn reduces complexity and improves compatibility with many log parsers. So in my opinion, adding keyed single line stack traces should be a configuration option in Serilog.Logfmt.

Something like adding .LogStackTrace(LogfmtStackTraceFormat.Keyed) could improve this library further while keeping backwards compatibility with already existing implementations and applications.

Should this be a considered PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants