Seq provider for DX.Logger - sends structured log events to a Seq server.
The Seq provider enables sending log entries from DX.Logger to a Seq server. Seq is a modern logging platform for structured log events with powerful search and analysis capabilities.
- Asynchronous Logging: Non-blocking through queue-based processing
- Automatic Batching: Collects multiple events and sends them bundled
- CLEF Format: Uses Compact Log Event Format (CLEF)
- Configurable: Batch size and flush interval adjustable
- Thread-safe: Can be used from multiple threads simultaneously
- Fault Tolerant: HTTP errors do not block the application
- Add
DX.Logger.Provider.Seq.pasto your project - Add the unit to your
usesclause:
uses
DX.Logger,
DX.Logger.Provider.Seq;// Configure Seq server
TSeqLogProvider.SetServerUrl('https://your-seq-server.example.com');
TSeqLogProvider.SetApiKey('your-api-key-here');
// Register provider
TDXLogger.Instance.RegisterProvider(TSeqLogProvider.Instance);
// Log as usual
DXLog('Application started');
DXLogError('Something went wrong!');Note: See CONFIGURATION.md for details on configuration with
config.local.ini.
// Set batch size (default: 10)
TSeqLogProvider.SetBatchSize(20);
// Set flush interval in milliseconds (default: 2000)
TSeqLogProvider.SetFlushInterval(5000);
// Register provider
TDXLogger.Instance.RegisterProvider(TSeqLogProvider.Instance);// Send all pending events immediately
TSeqLogProvider.Instance.Flush;The provider sends events in CLEF (Compact Log Event Format):
{"@t":"2025-11-18T13:45:30.123Z","@l":"Information","@m":"Application started","ThreadId":1234}
{"@t":"2025-11-18T13:45:31.456Z","@l":"Error","@m":"Something went wrong!","ThreadId":1234}| DX.Logger | Seq/CLEF | Description |
|---|---|---|
TLogLevel.Trace |
Verbose |
Detailed trace information |
TLogLevel.Debug |
Debug |
Debug information |
TLogLevel.Info |
Information |
Informational messages |
TLogLevel.Warn |
Warning |
Warnings |
TLogLevel.Error |
Error |
Errors |
Sets the URL of the Seq server (without /api/events/raw).
TSeqLogProvider.SetServerUrl('https://seq.example.com');Sets the API key for authentication with the Seq server.
TSeqLogProvider.SetApiKey('your-api-key-here');Specifies after how many events a batch is sent (default: 10).
TSeqLogProvider.SetBatchSize(50); // Sends after 50 eventsSets the maximum interval in milliseconds after which a batch is sent (default: 2000).
TSeqLogProvider.SetFlushInterval(1000); // Sends at most after 1 secondA complete example can be found at examples/SeqExample/SeqExample.dpr.
The provider uses a worker thread that:
- Reads log entries from a thread-safe queue
- Collects events until
BatchSizeis reached orFlushIntervalhas elapsed - Sends bundled events via HTTP POST to Seq
- Endpoint:
{ServerUrl}/api/events/raw - Method: POST
- Content-Type:
application/vnd.serilog.clef - Authentication:
X-Seq-ApiKeyHeader - Format: Newline-delimited JSON (CLEF)
HTTP errors are silently ignored to prevent logging issues from affecting the application. If needed, error handling can be customized in SendBatch.
- Batch Size: Larger batches reduce HTTP overhead but increase latency
- Flush Interval: Shorter intervals increase timeliness but generate more HTTP requests
- Queue Depth: Default is 1000 events - adjust if needed for very high throughput
MIT License - see main README of the DX.Logger project.