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

Added configuration to embed exception in message instead of using printStackTrace #2051

Merged
merged 3 commits into from Nov 10, 2020

Conversation

mellon85
Copy link
Contributor

@mellon85 mellon85 commented Nov 4, 2020

To avoid receiving the stack trace over multiple lines and send receive it as a single message I have added an option (embedException, which defaults to false for backward compatibility).

The format in case this feature is enabled looks like

<usual logline> <message> [exception:<exception type>: <message> <stack frame>, <stack frame>, ..]

where the content of the exception tag can be pasted in IntelliJ stack analyzer too.

@mellon85 mellon85 requested a review from a team as a code owner November 4, 2020 14:59
@mellon85 mellon85 force-pushed the dario.meloni/configurable-embed-exception branch from 46bcf9b to d20a47d Compare November 4, 2020 15:00
}

expect:
outputStream.toString() ==~ /^.* ERROR foo - log \[exception:java\.io\.IOException: wrong\]\[stack:\[.*\]\]\n$/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: will this format be compatible with IntelliJ analyse window?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! I'll check and in case try to format in a compatible way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change the format a bit but it's not compatible, copying anything inside [exception: ... ] will work.

Screen Recording 2020-11-06 at 11 10 43 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add a space following exception: and remove the surrounding brackets, would that work? Seems like simple normalization (without editing the text) would be a useful attribute

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like maybe you fixed it below...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it works by just pasting the whole logline, no additional cleaning needed

Changed the structure of the log to support pasting it in IntelliJ stack
strace analyzer
@mellon85 mellon85 merged commit 85da4b6 into master Nov 10, 2020
@mellon85 mellon85 deleted the dario.meloni/configurable-embed-exception branch November 10, 2020 07:57
@github-actions github-actions bot added this to the 0.68.0 milestone Nov 10, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants