Comments (6)
Thanks for your answer:
Is there a reason, you're calling Sentry.init manually? You should be able to set the logger, e.g. by exposing a
That was also my question in the Sentry issue tracker, as I did not want to call it as I was afraid that my env/properties were ignored when calling that, which was also the case I think. That is how we landed here on Github to get more help.
The code you are suggesting, looks like the correct way to do it, I will give a try later, thanks.
from sentry-java.
That's because we always set the logger to the System.out when debug
is configured, see here:
They would have to provide a custom ILogger
implementation which writes into the same file they use for log4j
from sentry-java.
I did set the options, but noticed it's complaining...
As I posted in your ticket system:
@Configuration
@Slf4j
public class SentryConfiguration {
@EventListener(ApplicationStartedEvent.class)
void configureSentry() {
Sentry.init(options -> {
log.info("Configuring Sentry");
options.setEnableExternalConfiguration(true);
options.setLogger(new SentryLogger());
});
}
}
```}
I don't think it's using anymore the EVn and application.yml settings, as it's complaining that the DNS is not set and I should set an empty string. But that already happens through the application.yml, but even dot I indicate it should load external properties, it is already complaining during this call.
Can you post me an example that works please?
from sentry-java.
Hey @edbras ,
I got this to work in my test app. The DSN does have to be provided to the Sentry.init() for this to work. The other options can still be provided externally, but only through environment variables. Setting the other options in either the application.properties or application.yml both caused it to stop working. Also, if I provide the DSN as an environment option as well, it also stopped working. This is my setup that works for me to output the debug logging to a file.
Sentry.init(options -> {
options.setEnableExternalConfiguration(true);
options.setDsn("https://[email protected]/4504181117091840");
options.setLogger(new Log4jSentryLogger());
});
export SENTRY_DEBUG=true
export SENTRY_TRACES_SAMPLE_RATE=1.0
from sentry-java.
Is there a reason, you're calling Sentry.init
manually? You should be able to set the logger, e.g. by exposing a Sentry.OptionsConfiguration<SentryOptions>
bean that'll let you customize options programatically without having to fall back to manual init.
@Bean
public Sentry.OptionsConfiguration<SentryOptions> optionsConfiguration() {
return options -> {
options.setLogger(new Log4jSentryLogger());
};
}
from sentry-java.
We're closing this now as it seems everyone has got it to work. Feel free to reopen if you need more help.
from sentry-java.
Related Issues (20)
- Issue with the p6spy's PreparedStatementWrapper HOT 4
- Please specify minSdkVersion for android HOT 4
- Move the onFinishCallback before the span is finished HOT 2
- How to specify the transport for a custom build HOT 4
- Compatibility Issues with Sentry Java (Android, NDK) and Breakpad Backend HOT 7
- Document lastEventId with User Feedback
- [Metrics] Add code location support to Metrics HOT 1
- [Metrics] `IllegalMonitorStateException` in `Sentry.metrics().notifyAll();` HOT 2
- [Android] [SentryHttpClientException] Exclusions HOT 11
- Sentry is grouping two messages even though the messages are different HOT 7
- CRASH: java.lang.NoClassDefFoundError: io.sentry.protocol.Contexts HOT 10
- Failed to init Sentry during appender initialization: DSN is required HOT 3
- [Starfish] Tag spans if they contribute to TTID / TTFD
- Add SentrySDK.detectedStartUpCrash
- Security warning because of insecure HTTP URL in release artifact HOT 4
- EventProcessor not working with transaction HOT 1
- Add span descriptions for OkHttp child spans HOT 5
- Gwani HOT 1
- Automatically capture gRPC errors / exceptions
- UncaughtExceptionHandlerIntegration leaks memory HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-java.