azurite-engine / Azurite

Azurite Game Engine is a 2D Java game engine built on top of LWJGL.
https://azurite-engine.github.io
MIT License
42 stars 20 forks source link

Crash Logger not showing sufficient information (feature suggestion) #89

Closed HilbertCurve closed 2 years ago

HilbertCurve commented 2 years ago

When the engine crashes, the logger only shows first stack frame of the crash, not any stack frames related to it. The logger also seems to throw an error of its own while printing out the stack frame.

Steps to reproduce

Set logging level to Log.ALL: Log.setLogLevel(Log.ALL); Put any error-generating function into the update method of the scene. I used this one:

int[] foo = new int[]{1};
int foo2 = foo[1];

Suggested behavior

An error message that shows the full stack frame, or some metric/setting that would enable that behavior

Current behavior

As described above, it only shows the first stack frame, and then some crash message related to the logger failing.

Error logs

[CRASH] {scenes.AudioDemo.main(AudioDemo.java:24) -> scenes.AudioDemo.update(AudioDemo.java:44)} Index 1 out of bounds for length 1
Exception in thread "main" java.lang.NullPointerException
    at util.Log.crash(Log.java:279)
    at util.Engine.showWindow(Engine.java:79)
    at scenes.AudioDemo.main(AudioDemo.java:24)
HilbertCurve commented 2 years ago

This would help when debugging the audio engine, because when an OpenAL error is received, it's detected in only one function, which would mean the highest frame in the stack would be that function and not where the programmer would want to debug. This is especially apparent in pull request #88

Juyas commented 2 years ago

yes, I know this error and I fixed it on a seperate branch, its basically just a missing null-ckeck.

Juyas commented 2 years ago

I could offer making a hotfix directly or making a pull request for the other branch I already fixed it on.

athaun commented 2 years ago

Hotfix manually added in commit https://github.com/azurite-engine/Azurite/commit/9aca15d7644ed9b20e2492805ef880818030fa48