-
-
Notifications
You must be signed in to change notification settings - Fork 452
Send Log4j2 logs to Sentry as logs #4517
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
base: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Send Log4j2 logs to Sentry as logs ([#4517](https://github.com/getsentry/sentry-java/pull/4517)) If none of the above apply, you can opt out of this check by adding |
Performance metrics 🚀
|
/** | ||
* @deprecated please use the non deprecated constructor instead. | ||
*/ | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange diff, it looked like you added something to deprecate it immediately lol
@sentry review |
On it! We are reviewing the PR and will provide feedback shortly. |
PR DescriptionThis pull request introduces the ability to capture log messages directly as Sentry logs, in addition to the existing functionality of capturing log events as Sentry events. This allows users to leverage Sentry's logging infrastructure for structured logging and analysis, independent of error reporting. Click to see moreKey Technical ChangesA new Architecture DecisionsThe decision was made to use Sentry's existing logging API ( Dependencies and InteractionsThis change depends on the Sentry Java SDK's logging API. It interacts with the existing event capturing mechanism in Risk ConsiderationsIntroducing a new logging path could potentially increase the volume of data sent to Sentry, which might impact performance and billing. Users should carefully configure the Notable Implementation DetailsThe |
/** | ||
* @deprecated please use the non deprecated constructor instead. | ||
*/ | ||
@Deprecated | ||
@SuppressWarnings("InlineMeSuggester") | ||
public SentryAppender( | ||
final @NotNull String name, | ||
final @Nullable Filter filter, | ||
final @Nullable String dsn, | ||
final @Nullable Level minimumBreadcrumbLevel, | ||
final @Nullable Level minimumEventLevel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecated constructor should include proper JavaDoc explaining the migration path and when it will be removed. Consider adding a @since
and @removal
tag to provide clear versioning information.
/** | |
* @deprecated please use the non deprecated constructor instead. | |
*/ | |
@Deprecated | |
@SuppressWarnings("InlineMeSuggester") | |
public SentryAppender( | |
final @NotNull String name, | |
final @Nullable Filter filter, | |
final @Nullable String dsn, | |
final @Nullable Level minimumBreadcrumbLevel, | |
final @Nullable Level minimumEventLevel, | |
/** | |
* @deprecated This constructor is deprecated. Please use {@link #SentryAppender(String, Filter, String, Level, Level, Level, Boolean, ITransportFactory, IScopes, String[])} instead. | |
* @since 7.0.0 | |
* @removal 8.0.0 | |
*/ | |
@Deprecated | |
@SuppressWarnings("InlineMeSuggester") |
📜 Description
Allow setting a minimumLevel to our Log4j2 integration which causes logs >= that level to be sent to Sentry as logs.
Setting the minimum level can be done on the appender config in
log4j2.xml
:You also have to enable the logs feature:
Either in
sentry.properties
:or when calling
Sentry.init
:💡 Motivation and Context
Closes #4403
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps