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

Print stack trace when logging errors #984

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

frengor
Copy link
Contributor

@frengor frengor commented Mar 17, 2024

Description

This PR makes loggers print the stack trace of logged errors, which was simply ignored before.

Example

logger.log(Level.SEVERE, "Error message", new Exception("Error!"));

Before:

[00:32:28 SEVERE]: Error message

After:

[00:38:35 SEVERE]: Error message
java.lang.Exception: Error!
    at com.fren_gor.tests.Test.test(Test.java:24)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:728)
    etc. etc.

Checklist

The following items should be checked before the pull request can be merged.

  • Code follows existing style.
  • Unit tests added (if applicable).

Copy link
Contributor

@Insprill Insprill left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you!

@Insprill Insprill enabled auto-merge (squash) April 2, 2024 13:51
Copy link

sonarcloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
1.8% Duplication on New Code

See analysis details on SonarCloud

@Insprill Insprill merged commit 2b2ce39 into MockBukkit:v1.20 Apr 2, 2024
3 checks passed
@frengor frengor deleted the feature/logger-print-stack-trace branch April 2, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants