Class CompositeLogExporter
-
- All Implemented Interfaces:
-
io.opentelemetry.sdk.logs.export.LogRecordExporter
,java.io.Closeable
,java.lang.AutoCloseable
public final class CompositeLogExporter implements LogRecordExporter
A composite log exporter that forwards log records to multiple underlying exporters.
This allows sending the same log records to multiple destinations (e.g., OTLP endpoint and local debug output) without duplicating the sampling logic. All operations (export, flush, shutdown) are forwarded to all underlying exporters.
The composite operation succeeds only if ALL underlying exporters succeed.
-
-
Constructor Summary
Constructors Constructor Description CompositeLogExporter(LogRecordExporter exporters)
Convenience constructor that accepts a variable number of exporters. CompositeLogExporter(List<LogRecordExporter> exporters)
-
Method Summary
Modifier and Type Method Description CompletableResultCode
export(Collection<LogRecordData> logRecords)
Exports log records to all underlying exporters. CompletableResultCode
flush()
Flushes all underlying exporters. CompletableResultCode
shutdown()
Shuts down all underlying exporters. -
-
Constructor Detail
-
CompositeLogExporter
CompositeLogExporter(LogRecordExporter exporters)
Convenience constructor that accepts a variable number of exporters.- Parameters:
exporters
- The exporters to compose
-
CompositeLogExporter
CompositeLogExporter(List<LogRecordExporter> exporters)
- Parameters:
exporters
- The list of underlying exporters to forward operations to
-
-
Method Detail
-
export
CompletableResultCode export(Collection<LogRecordData> logRecords)
Exports log records to all underlying exporters.
- Parameters:
logRecords
- The log records to export- Returns:
A CompletableResultCode that succeeds only if all underlying exports succeed
-
flush
CompletableResultCode flush()
Flushes all underlying exporters.
- Returns:
A CompletableResultCode that succeeds only if all underlying flushes succeed
-
shutdown
CompletableResultCode shutdown()
Shuts down all underlying exporters.
- Returns:
A CompletableResultCode that succeeds only if all underlying shutdowns succeed
-
-
-
-