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

Let me enable logging #970

Closed
pvditto opened this issue Sep 5, 2024 · 3 comments · Fixed by #990
Closed

Let me enable logging #970

pvditto opened this issue Sep 5, 2024 · 3 comments · Fixed by #990

Comments

@pvditto
Copy link

pvditto commented Sep 5, 2024

Problem Statement

I have an issue where my app crashes but no report is generated by Sentry. I want to understand Sentry's behavior but by default no logs at all are emitted. The configuration has a debug option but it seems to only log at error or warning level. I am not able to understand what Sentry does or what the issue is that prevents my app's crash from being reported.

Solution Brainstorm

Reading the @sentry/utils source code I was able to figure out that I can enable more verbose logging with

const { logger } = require('@sentry/utils');
logger.enable();

but this does not seem to be documented anywhere. Can you offer an API or configuration option for this?

side note: by enabling this, I found out that my app's crash is registered as an "abnormal" exit and not a "crash". I still don't know why that is but at least now I have some information to continue investigating.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 5, 2024
@timfish
Copy link
Collaborator

timfish commented Sep 5, 2024

Setting debug: true in your main process Sentry.init should enable logging.

For main process native crashes or abnormal exits, the event is not sent until the next app startup since the process exits immediately.

@pvditto
Copy link
Author

pvditto commented Sep 5, 2024

I took another look and maybe this could have been filed in another repo because the line that makes all the difference is this if (enabled) check here. enabled is not true if debug: true has been set for Sentry.init().

But another thing surprised me in your answer: should I expect an event to be sent for abnormal exits? Because I don't see anything and assumed that was the reason and that events would only be sent for crash exits.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 5, 2024
@timfish
Copy link
Collaborator

timfish commented Sep 5, 2024

enabled is not true if debug: true has been set for Sentry.init().

I have not seen this before. Do you have a minimal example that reproduces this? I've checked with the latest version and setting debug: true results in debug output.

should I expect an event to be sent for abnormal exits?

Yes:

  • if the main process does not exit cleanly, on the next app start:
    • If there is a minidump file on disk, the previous app session is classified as a main process crash
    • If there is no minidump file, the previous app session is classified as an abnormal exit

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

Successfully merging a pull request may close this issue.

2 participants