-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: Log4j configurations and wording #11395
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
Changes from 1 commit
4c06f9e
6400455
269ac21
35e3e61
b6521e2
e17118d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| When used together with one of the logging framework integrations, the Java SDK captures all error logs as events. If you see a particular kind of error very often that has a `logger` tag, you can ignore that particular logger entirely. For more information see our <Link to="/platforms/java/guides/logback/">Logback</Link> or <Link to="/platforms/java/guides/log4j2/">Log4j 2.x</Link> integration. | ||
| When used together with one of the logging framework integrations, the Java SDK captures all error logs as events. If you see a particular kind of error very often that has a `logger` tag, you can ignore that particular logger entirely. For more information see our <Link to="/platforms/java/guides/logback/">Logback</Link> or <Link to="/platforms/java/guides/log4j2/">Log4j 2</Link> integration. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,36 +6,37 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se | |
|
|
||
| </Note> | ||
|
|
||
|
|
||
| ```xml | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Configuration status="warn" packages="org.apache.logging.log4j.core,io.sentry.log4j2"> | ||
| <Appenders> | ||
| <Console name="Console" target="SYSTEM_OUT"> | ||
| <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> | ||
| </Console> | ||
| <Sentry name="Sentry" | ||
| dsn="___PUBLIC_DSN___" /> | ||
| </Appenders> | ||
| <Loggers> | ||
| <Root level="info"> | ||
| <AppenderRef ref="Sentry"/> | ||
| <AppenderRef ref="Console"/> | ||
| </Root> | ||
| </Loggers> | ||
| <Configuration xmlns="https://logging.apache.org/xml/ns" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd"> | ||
vy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <Appenders> | ||
| <Console name="CONSOLE" target="SYSTEM_OUT"> | ||
| <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> | ||
| </Console> | ||
| <Sentry name="SENTRY" dsn="___PUBLIC_DSN___"/> | ||
| </Appenders> | ||
|
|
||
| <Loggers> | ||
| <Root level="INFO"> | ||
| <AppenderRef ref="CONSOLE"/> | ||
| <AppenderRef ref="SENTRY" level="ERROR"/> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a particular reason for adding the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lbloder, earlier the snippet was as follows: <Root level="info">
<AppenderRef ref="Sentry"/>
<AppenderRef ref="Console"/>
</Root>Though this didn't capture the configuration stated at the beginning of the
That is, sending
I am not able to follow you. I fixed
Hence, AFAIC, all configurations now match what is stated to be expected from them.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vy Sorry for the confusion.
|
||
| </Root> | ||
| </Loggers> | ||
|
|
||
| </Configuration> | ||
| ``` | ||
|
|
||
| `SentryAppender` does not support Log4j2's [async mode](https://logging.apache.org/log4j/2.x/manual/async.html). The Sentry Java SDK itself is already asynchronous and does not perform any blocking operation on the calling thread. | ||
| `SentryAppender` does not support [Log4j's asynchronous loggers](https://logging.apache.org/log4j/2.x/manual/async.html). The Sentry Java SDK itself is already asynchronous and does not perform any blocking operation on the calling thread. | ||
|
|
||
| ### DSN Configuration | ||
|
|
||
| Note that **you need to configure your DSN** (client key) only if you wish to initialize the SDK through the log4j2 integration. If you're planning to use `Sentry.init` to provide configuration, such as by using the `beforeSend` callback, you **should not** provide the DSN in both `Sentry.init` and the appender configuration; just leave it out of the appender configuration in this case. | ||
|
|
||
| Note that **you need to configure your DSN** (client key) only if you wish to initialize the SDK through the Log4j 2 integration. If you're planning to use `Sentry.init` to provide configuration, such as by using the `beforeSend` callback, you **should not** provide the DSN in both `Sentry.init` and the appender configuration; just leave it out of the appender configuration in this case. | ||
|
|
||
| ```xml | ||
| <Sentry name="Sentry" | ||
| dsn="___PUBLIC_DSN___" /> | ||
| <Sentry name="SENTRY" dsn="___PUBLIC_DSN___" /> | ||
| ``` | ||
|
|
||
| If the DSN is not present in the `log4j2.xml` configuration, Sentry will attempt to read it from the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration. | ||
|
|
@@ -59,9 +60,8 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi | |
| ```xml | ||
| <!-- Setting minimumBreadcrumbLevel modifies the default minimum level to add breadcrumbs from INFO to DEBUG --> | ||
| <!-- Setting minimumEventLevel the default minimum level to capture an event from ERROR to WARN --> | ||
| <Sentry name="Sentry" | ||
| <Sentry name="SENTRY" | ||
| dsn="___PUBLIC_DSN___" | ||
| minimumBreadcrumbLevel="DEBUG" | ||
| minimumEventLevel="WARN" | ||
| /> | ||
| minimumEventLevel="WARN"/> | ||
| ``` | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.