Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Sentry Log feature to Java SDK #4372

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented May 6, 2025

📜 Description

Add API for capturing logs.

💡 Motivation and Context

Partial implementation for #4350

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

sentry.sdk.name: The name of the SDK that sent the log
sentry.sdk.version: The version of the SDK that sent the log
[BACKEND SDKS ONLY] server.address: The address of the server that sent the log. Equivalent to server_name we attach to errors and transactions.

Copy link
Contributor

github-actions bot commented May 6, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add Sentry Log feature to Java SDK ([#4372](https://github.com/getsentry/sentry-java/pull/4372))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 0627186

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

Left some comments, otherwise LGTM as a first implementation

@adinauer
Copy link
Member Author

adinauer commented May 7, 2025

Thanks @lcian I changed the code in #4374 in order to reduce merge conflicts.

Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

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

doing a drive by review since we also implement logs for Dart :)

Comment on lines +13 to +22
public final class SentryLogEvent implements JsonUnknown, JsonSerializable {

private @NotNull SentryId traceId;
private @NotNull Double timestamp;

private @NotNull String body;

private @Nullable SentryLevel level;
private @Nullable Map<String, SentryLogEventAttributeValue> attributes;
private @Nullable Map<String, Object> unknown;
Copy link
Contributor

@buenaflor buenaflor May 7, 2025

Choose a reason for hiding this comment

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

I think the optional severity_number is missing which later on is inferred by the SDK if not set, e.g

https://github.com/getsentry/sentry-javascript/blob/caa13167c5d6e35dd2a5dbc08b86f0f0f40681eb/packages/core/src/logs/constants.ts#L8

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.

3 participants