Testing java example does not send events

Hello! I am new using sentry, and I think something I am not doing well.
To test it, I am using sentry examples.
I have started with https://github.com/getsentry/examples/tree/master/java/log4j-1.x, and I have configured the project dsn, both as a parameter of the properties (sentry.properties), and as a variable of environment (SENTRY_DSN). In both cases I get the same result.

When I execute it, with “mvn exec: java”, I get as a result:

[INFO] Scanning for projects…
[INFO] ----------------< io.sentry:sentry-java-log4j2-example >----------------
[INFO] Building sentry-java-log4j2-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] — exec-maven-plugin:1.4.0:java (default-cli) @ sentry-java-log4j2-example —
18:20:05.561 [io.sentry.example.Application.main()] DEBUG example.Application - Debug message
18:20:05.562 [io.sentry.example.Application.main()] INFO example.Application - Info message
18:20:05.562 [io.sentry.example.Application.main()] WARN example.Application - Warn message
[io.sentry.example.Application.main()] WARN io.sentry.DefaultSentryClientFactory - No ‘stacktrace.app.packages’ was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry.
[io.sentry.example.Application.main()] WARN io.sentry.DefaultSentryClientFactory - No ‘stacktrace.app.packages’ was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry. See documentation: https://docs.sentry.io/clients/java/config/#in-application-stack-frames
18:20:05.707 [io.sentry.example.Application.main()] ERROR example.Application - Caught exception!
java.lang.ArithmeticException: / by zero
at io.sentry.example.Application.main(Application.java:17) [classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) [exec-maven-plugin-1.4.0.jar:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.846 s
[INFO] Finished at: 2020-02-13T18:20:05+01:00
[INFO] ------------------------------------------------------------------------
[Thread-1] WARN io.sentry.connection.AsyncConnection - Graceful shutdown took too much time, forcing the shutdown.
[Thread-1] WARN io.sentry.connection.AsyncConnection - 0 tasks failed to execute before shutdown.

When I checking if events have come to sentry, none appear. Do you know if I am doing something wrong?
Thank you!

hey @atrigoma have you tried using the official docs? https://docs.sentry.io/clients/java/

do you want to integrate Sentry with log4j v1.x in a java backend project, is that right?
maybe https://docs.sentry.io/clients/java/integrations/#log4j-1x helps?

Thanks marandaneto!!
Now it works!! :slight_smile: But, only in the case of uncaught exceptions. :frowning:
When I use error traces (like logger.error (“Error message”):wink: it isn’t sending them.
I think, the problem is because I don’t have a correct configuration for the application.yaml.
Do you have any example of this configuration (in yaml o properties, because we use a config service to get the configuration, and it just undertand these formats)?

Thanks in advance!

glad that it worked, mmm I dont have a yaml sample, maybe have a look at https://github.com/getsentry/sentry-java/issues/748

It’s possible to use yaml though, you just need to imitate the data structure.
If it doesn’t work, raise an issue on https://github.com/getsentry/sentry-java/issues with all the info you have, even code snippets would help, so we’ll have more context to look into it, thanks :slight_smile: