Class SimpleLogProcessor

java.lang.Object
io.opentelemetry.sdk.logs.export.SimpleLogProcessor
All Implemented Interfaces:
LogProcessor, Closeable, AutoCloseable

public final class SimpleLogProcessor extends Object implements LogProcessor
An implementation of the LogProcessor that passes LogData directly to the configured exporter.

This processor will cause all logs to be exported directly as they finish, meaning each export request will have a single log. Most backends will not perform well with a single log per request so unless you know what you're doing, strongly consider using BatchLogProcessor instead, including in special environments such as serverless runtimes. SimpleLogProcessor is generally meant to for testing only.

  • Method Details

    • create

      public static LogProcessor create(LogExporter exporter)
      Returns a new SimpleLogProcessor which exports logs to the LogExporter synchronously.

      This processor will cause all logs to be exported directly as they finish, meaning each export request will have a single log. Most backends will not perform well with a single log per request so unless you know what you're doing, strongly consider using BatchLogProcessor instead, including in special environments such as serverless runtimes. SimpleLogProcessor is generally meant to for testing only.

    • emit

      public void emit(LogData logData)
      Description copied from interface: LogProcessor
      Emit a log.
      Specified by:
      emit in interface LogProcessor
      Parameters:
      logData - the log
    • shutdown

      public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Description copied from interface: LogProcessor
      Shutdown the log processor.
      Specified by:
      shutdown in interface LogProcessor
      Returns:
      result
    • forceFlush

      public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
      Description copied from interface: LogProcessor
      Process all logs that have not yet been processed.
      Specified by:
      forceFlush in interface LogProcessor
      Returns:
      result