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

make it easier to ingest stack traces into logging backends #809

Open
zeitlinger opened this issue Apr 23, 2024 · 6 comments
Open

make it easier to ingest stack traces into logging backends #809

zeitlinger opened this issue Apr 23, 2024 · 6 comments

Comments

@zeitlinger
Copy link

zeitlinger commented Apr 23, 2024

Problem

Logging backends, such as Loki, ingest stack traces as one string.

Therefore, it would be good to have an option in the json encoder, to emit stack traces plainly - as a string.

Instead of

"throwable": {
    "className": "java.lang.RuntimeException",
    "message": "test",
    "stepArray": [
      {
        "className": "ch.qos.logback.classic.encoder.JsonEncoderTest",
        "methodName": "withThrowable",
        "fileName": "JsonEncoderTest.java",
        "lineNumber": 251
      },

something like

 "throwable": {
    "className": "java.lang.RuntimeException",
    "message": "test",
    "stackTrace": "java.lang.RuntimeException: test\n\tat ch.qos.lo

Proposed solution

Add a withPlainStackTrace option to the json encoder.

PR: #808

@zeitlinger
Copy link
Author

@ceki wdyt?

@ceki
Copy link
Member

ceki commented Apr 24, 2024

I looked at the code. The changes are reasonable. However, the code which was already rather complex becomes harder to read with your changes.

I think a pluggable strategy for handling the stack trace output format starts to make sense. A default strategy and a "PlainStackTrace" strategy. This should not be hard to put in place. Let me know if you feel comfortable with the idea and making this change.

Also, could your PR be please compressed into a single commit?

@zeitlinger
Copy link
Author

Also, could your PR be please compressed into a single commit?

You can change the settings to always squash PRs BTW

@zeitlinger
Copy link
Author

Also, could your PR be please compressed into a single commit?

done 😄

@hazendaz
Copy link
Contributor

hazendaz commented Apr 25, 2024 via email

@zeitlinger
Copy link
Author

proper git usage...;)

It's like tabs vs. spaces 😉

Rebasing from a remote squash is a little bit harder - but it has never bothered me so far.
Anyways, just wanted to point out the feature 😄

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

3 participants