1

我在我的 Spring Boot 项目中使用以下依赖项在哨兵服务器中发送错误消息。

compile 'io.sentry:sentry-logback:1.7.5'
compile('net.logstash.logback:logstash-logback-encoder:4.7')
compile group: 'ch.qos.logback.contrib', name: 'logback-json-classic', version: '0.1.5'
compile group: 'ch.qos.logback.contrib', name: 'logback-jackson', version: '0.1.5'

我在 manifest.yml 文件中配置了 SENTRY_DSN 值。并在 logback.xml 下面记录级别

<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender" >
    <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<appender name="SENTRY" class="io.sentry.logback.SentryAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>ERROR</level>
    </filter>
</appender>

<root level="debug">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="SENTRY"/>
</root>

当我尝试在哨兵中发送一些消息时,出现以下错误:

io.sentry.connection.ConnectionException: An exception occurred while submitting the event to the Sentry server.
at io.sentry.connection.HttpConnection.doSend(HttpConnection.java:216)
at io.sentry.connection.AbstractConnection.send(AbstractConnection.java:76)
at io.sentry.connection.AsyncConnection$EventSubmitter.run(AsyncConnection.java:185)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:933)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at io.sentry.connection.HttpConnection.doSend(HttpConnection.java:172)
... 5 common frames omitted

您能否让我知道如何解决此异常并将日志发送到哨兵服务器。

注意:我在 Slack 频道中配置了 SENTRY 日志通知。

4

0 回答 0