use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class OtlpHttpLogExporterTest method testServerErrorParseError.
@Test
@SuppressLogger(OkHttpExporter.class)
void testServerErrorParseError() {
server.enqueue(HttpResponse.of(HttpStatus.INTERNAL_SERVER_ERROR, APPLICATION_PROTOBUF, "Server error!"));
OtlpHttpLogExporter exporter = builder.build();
exportAndAssertResult(exporter, /* expectedResult= */
false);
LoggingEvent log = logs.assertContains("Failed to export logs. Server responded with HTTP status code 500. Error message: Unable to parse response body, HTTP status message:");
assertThat(log.getLevel()).isEqualTo(Level.WARN);
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SimpleLogProcessorTest method addLogRecord_ExporterError.
@Test
@SuppressLogger(SimpleLogProcessor.class)
void addLogRecord_ExporterError() {
LogData logData = TestUtil.createLogData(DEBUG, "Log message");
when(logExporter.export(any())).thenThrow(new RuntimeException("Exporter error!"));
logProcessor.emit(logData);
logProcessor.emit(logData);
verify(logExporter, times(2)).export(Collections.singletonList(logData));
}
Aggregations