You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Send Log4j2 logs to Sentry as logs
* changelog
* better javadoc for deprecation
* Format code
* trigger ci again
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,27 @@
20
20
```properties
21
21
io.sentry.jul.SentryHandler.minimumLevel=CONFIG
22
22
```
23
+
- Send Log4j2 logs to Sentry as logs ([#4517](https://github.com/getsentry/sentry-java/pull/4517))
24
+
- You need to enable the logs feature either in `sentry.properties`:
25
+
```properties
26
+
logs.enabled=true
27
+
```
28
+
- If you manually initialize Sentry, you may also enable logs on `Sentry.init`:
29
+
```java
30
+
Sentry.init(options -> {
31
+
...
32
+
options.getLogs().setEnabled(true);
33
+
});
34
+
```
35
+
- It is also possible to set the `minimumLevel` in `log4j2.xml`, meaning any log message >= the configured level will be sent to Sentry and show up under Logs:
Copy file name to clipboardExpand all lines: sentry-log4j2/api/sentry-log4j2.api
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,10 @@ public final class io/sentry/log4j2/BuildConfig {
6
6
public class io/sentry/log4j2/SentryAppender : org/apache/logging/log4j/core/appender/AbstractAppender {
7
7
public static final field MECHANISM_TYPE Ljava/lang/String;
8
8
public fun <init> (Ljava/lang/String;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Ljava/lang/Boolean;Lio/sentry/ITransportFactory;Lio/sentry/IScopes;[Ljava/lang/String;)V
9
+
public fun <init> (Ljava/lang/String;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Ljava/lang/Boolean;Lio/sentry/ITransportFactory;Lio/sentry/IScopes;[Ljava/lang/String;)V
9
10
public fun append (Lorg/apache/logging/log4j/core/LogEvent;)V
10
-
public static fun createAppender (Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Ljava/lang/String;Ljava/lang/Boolean;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;)Lio/sentry/log4j2/SentryAppender;
11
+
protected fun captureLog (Lorg/apache/logging/log4j/core/LogEvent;)V
12
+
public static fun createAppender (Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Ljava/lang/String;Ljava/lang/Boolean;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;)Lio/sentry/log4j2/SentryAppender;
11
13
protected fun createBreadcrumb (Lorg/apache/logging/log4j/core/LogEvent;)Lio/sentry/Breadcrumb;
12
14
protected fun createEvent (Lorg/apache/logging/log4j/core/LogEvent;)Lio/sentry/SentryEvent;
0 commit comments